Skip to content

Commit b6ffeb4

Browse files
committed
replacer tip: Add x-bug-bounty header
Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
1 parent 834147b commit b6ffeb4

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

other/tips/replacer/match-and-replace/README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,34 @@ extReplacer.getParams().addRule(newRule);
260260

261261
## Misc
262262

263-
- Help companies to identify your traffic and separate it from malicious traffic by adding a custom header
263+
- Help companies to identify your traffic and separate it from malicious traffic by adding a custom header (ex: `X-Bug-Bounty`, or `X-Header-Hackerone`).
264+
265+
![](images/xbb-header.png)
266+
267+
For example a header that:
268+
- includes your username: `X-Bug-Bounty: YourBBUsername` or email: `X-Bug-Bounty: user@domain.com`
269+
- includes a unique or identifiable flag: `X-Bug-Bounty: ID-<sha256-flag>`
270+
271+
Source: <https://danaepp.com/why-the-x-bug-bounty-header-matters-for-hackers>
272+
273+
<details>
274+
<summary>Add X-Bug-Bounty header</summary>
275+
276+
```js
277+
// This script adds a Replacer rule
278+
var extReplacer = control.getExtensionLoader().getExtension("ExtensionReplacer");
279+
280+
var replacerRule = Java.type("org.zaproxy.zap.extension.replacer.ReplacerParamRule");
281+
// Match types: REQ_HEADER, REQ_HEADER_STR, REQ_BODY_STR, RESP_HEADER, RESP_HEADER_STR, RESP_BODY_STR
282+
var matchType = Java.type("org.zaproxy.zap.extension.replacer.ReplacerParamRule.MatchType");
283+
284+
// https://github.com/zaproxy/zap-extensions/blob/e072df8ca4f7aff54d6e2dda98cfd8503810fa2c/addOns/replacer/src/main/java/org/zaproxy/zap/extension/replacer/ReplacerParamRule.java#L93-L107
285+
var newRule = new replacerRule("Add XBB header", "", matchType.REQ_HEADER, "X-Bug-Bounty", false, "YourBBUsername", null, false, false);
286+
extReplacer.getParams().addRule(newRule);
287+
```
288+
289+
</details>
290+
264291

265292
![](images/hackerone-header.png)
266293

Loading

0 commit comments

Comments
 (0)