Skip to content

Commit e1bb7ac

Browse files
authored
Merge pull request #258 from kingthorin/rand-fuzz
feat: Add SecureRandom fuzz payload generator JS script
2 parents 53ce169 + 0efe183 commit e1bb7ac

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77
### Added
88
- variant/CompoundCookies.js - An input vector script that handles splitting of compound cookies (Issue 6582).
99
- active/corsair.py > An active scan script to check for CORS related issues.)
10+
- payloadgenerator/securerandom.js > A fuzzer payload generator script that uses Java's SecureRandom as it's source (related to issue 6892).
1011

1112
## [13] - 2021-10-14
1213
### Fixed

payloadgenerator/securerandom.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Auxiliary variables/constants for payload generation.
2+
var SecureRandom = Java.type("java.security.SecureRandom");
3+
var random = new SecureRandom();
4+
var NUMBER_OF_PAYLOADS = 10;
5+
var INITIAL_VALUE = 1;
6+
var count = INITIAL_VALUE;
7+
8+
function getNumberOfPayloads() {
9+
return NUMBER_OF_PAYLOADS;
10+
}
11+
12+
function hasNext() {
13+
return (count <= NUMBER_OF_PAYLOADS);
14+
}
15+
16+
function next() {
17+
count++;
18+
// There are other data type options offered by SecureRandom
19+
// https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/security/SecureRandom.html
20+
// If you don't want leading negative signs on ints you could use Math.abs
21+
// If you want to pad to a certain length you could do something like:
22+
// String.format("%010d", random.nextint());'
23+
return random.nextInt();
24+
}
25+
26+
function reset() {
27+
count = INITIAL_VALUE;
28+
}
29+
30+
function close() {
31+
}

0 commit comments

Comments
 (0)