Skip to content

Type confusion bug in WriteFloatGeneric #12179

@deian

Description

@deian

The buffer writeFloatLE family functions are prone to code [remote] execution attacks via type confusion. The binding layer WriteFloatGeneric function just casts the first argument:

Local<Uint8Array> ts_obj = args[0].As<Uint8Array>();

Local<Uint8Array> ts_obj = args[0].As<Uint8Array>();

Few methods are called on the ts_obj after which if you choose a good argument means executing code with some choice.

For example, the following doesn't crash until the memcpy on my machine:

Buffer.prototype.writeFloatLE.call(0xdeadbeef, 0, 0, true);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bufferIssues and PRs related to the buffer subsystem.c++Issues and PRs that require attention from people who are familiar with C++.securityIssues and PRs related to security.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions