jazzer.js icon indicating copy to clipboard operation
jazzer.js copied to clipboard

how to fuzz functions with multilpe parameters?

Open 7c opened this issue 1 year ago • 3 comments

const os = require('os');
function encrypt_rc4_base32(body, keyString) {
    if (body) console.log(body)
    const key = Buffer.from(keyString)
    const cipher = crypto.createCipheriv('rc4', key, null);
    let encrypted = cipher.update(body, 'ascii');
    encrypted = Buffer.from([...encrypted, ...cipher.final()])
    let base32_encoded = base32.stringify(encrypted, { pad: false })
    return base32_encoded
}
// file: fuzzTarget.js
module.exports.fuzz = function (data) {
    encrypt_rc4_base32(data.toString());
};

thanks!

7c avatar Jan 25 '24 13:01 7c

You can use the FuzzedDataProvider that can help you with splitting up data (which is a Buffer) that you get from the fuzzer. Here is an example: https://github.com/CodeIntelligenceTesting/jazzer.js/blob/main/examples/bug-detectors/command-injection/fuzz.js

oetr avatar Jan 25 '24 14:01 oetr

i want to know in the above example will the fuzzer will put the same corpus data in the both parameters or the different data?

harisab2547 avatar Apr 16 '24 13:04 harisab2547

In the example above, keyString will always be undefined.

oetr avatar Apr 16 '24 14:04 oetr