Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to fuzz functions with multilpe parameters? #765

Open
7c opened this issue Jan 25, 2024 · 3 comments
Open

how to fuzz functions with multilpe parameters? #765

7c opened this issue Jan 25, 2024 · 3 comments

Comments

@7c
Copy link

7c commented Jan 25, 2024

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!

@oetr
Copy link
Contributor

oetr commented Jan 25, 2024

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

@harisab2547
Copy link

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?

@oetr
Copy link
Contributor

oetr commented Apr 16, 2024

In the example above, keyString will always be undefined.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants