-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use crypto.randomInt() Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> --------- Signed-off-by: Matteo Collina <[email protected]>
- Loading branch information
Showing
1 changed file
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 comment
on commit c2d78cd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an attacker can access a few generated values of Math.random() and has control over one of the fields of a multipart request, they can add or overwrite fields that are not meant to be controllable.
If there is a mechanism in an app that sends multipart requests to an attacker-controlled website, they can use this to leak the necessary values.
I wouldn't consider this a vulnerability honestly, but the issue is still there, albeit less feasible now. The fix should throw if the body parts contain the boundary.
the boundary delimiter MUST NOT appear inside any of
the encapsulated parts
random = (max) => Math.floor(Math.random(max))
Random result is always 0.
Should be:
random = (max) => Math.floor(Math.random() * max)