Skip to content

DOS: js expression make nodejs crash #9295

Description

@phra
  • Version: 6.9.1
  • Platform: Linux kali 4.7.0-kali1-686-pae SMP Debian 4.7.6-1kali1 (2016-10-17) i686 GNU/Linux
  • Subsystem: js built in prototypes

hi,

i was doing some javascript sorcery and i found out that the following js expression make the nodejs kill itself because it's tampering the prototype of Array.

Array.prototype.push = Array.prototype.push.bind(Array.prototype);

e.g.

> Array.prototype.push = Array.prototype.push.bind(Array.prototype)                                                  
[Function: bound push]                                       
> internal/process/next_tick.js:67            
      callback();                
      ^                                                

TypeError: callback is not a function  
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

nodejs is crashing at this line -> https://github.com/nodejs/node/blob/master/lib/internal/process/next_tick.js#L67
i think that making not writable and not configurable the prototypes of built in types can prevent such very evil things.

what do you think about guys?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions