I'm learning how use OWASP ZAP and I'd like to know how fuzzer at the same time the header and the body in a request using the same payload script. I am trying to do this lab for practise:
For emulate the pitchfork behavior of Burp suite pro:
ZAP missing payload mode pitchfork
The problem is when I have to fuzzer the header and the body in the same payload. I receive a httpmalformedheaderexpection and the fuzzer doesn't start. This is what I'm trying:
// Auxiliary variables/constants for payload generation.
var INITIAL_VALUE = 1;
var count = INITIAL_VALUE;
var name = ["carlos","root","admin"];
var NUMBER_OF_PAYLOADS = name.length;
/**
* Returns the number of generated payloads, zero to indicate unknown number.
* The number is used as a hint for progress calculations.
*
* @return {number} The number of generated payloads.
*/
function getNumberOfPayloads() {
return NUMBER_OF_PAYLOADS;
}
/**
* Returns true if there are still payloads to generate, false otherwise.
*
* Called before each call to next().
*
* @return {boolean} If there are still payloads to generate.
*/
function hasNext() {
return (count <= NUMBER_OF_PAYLOADS);
}
/**
* Returns the next generated payload.
*
* This method is called while hasNext() returns true.
*
* @return {string} The next generated payload.
*/
function next() {
payload = count;
count++;
return payload + "\r\n\r\n" + "username=asdf&password=1234567890"; //error, not using the names array yet
}
/**
* Resets the internal state of the payload generator, as if no calls to
* hasNext() or next() have been previously made.
*
* Normally called once the method hasNext() returns false and while payloads
* are still needed.
*/
function reset() {
count = INITIAL_VALUE;
}
/**
* Releases any resources used for generation of payloads (for example, a file).
*
* Called once the payload generator is no longer needed.
*/
function close() {
}
Fuzz locations:
...
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
X-Forwarded-For: FUZZER
Generated payloads:
1
username=asdf&password=123456789
2
username=asdf&password=123456789
3
username=asdf&password=123456789
Any fix/workaround to complete the exercise? Thanks in advance.