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

Param Digger Tracker #7694

Open
1 of 5 tasks
ArkaprabhaChakraborty opened this issue Jan 16, 2023 · 20 comments
Open
1 of 5 tasks

Param Digger Tracker #7694

ArkaprabhaChakraborty opened this issue Jan 16, 2023 · 20 comments
Assignees
Labels
add-on In:paramdigger Items pertaining to the Param Digger add-on. tracker

Comments

@ArkaprabhaChakraborty
Copy link
Contributor

ArkaprabhaChakraborty commented Jan 16, 2023

This is the list of tasks underway for the Param Digger add-on for ZAP

@thc202
Copy link
Member

thc202 commented Apr 21, 2023

There are some exceptions when using the header guesser, e.g.:

[ZAP-ParamGuesser-0-thread-2] ERROR org.zaproxy.addon.paramdigger.HeaderGuesser - java.lang.NullPointerException
java.lang.NullPointerException: null
	at org.zaproxy.addon.paramdigger.HeaderGuesser.checkFirstRequestPoisoning(HeaderGuesser.java:320) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.forwardTemplate(HeaderGuesser.java:218) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.forwardingHeaderGuess(HeaderGuesser.java:182) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.startGuess(HeaderGuesser.java:164) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.run(HeaderGuesser.java:132) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	at java.lang.Thread.run(Thread.java:829) ~[?:?]

@ArkaprabhaChakraborty
Copy link
Contributor Author

ArkaprabhaChakraborty commented Apr 21, 2023 via email

@thc202
Copy link
Member

thc202 commented Apr 21, 2023

You can reproduce with the following server (extender script), e.g.:

var address = "0.0.0.0"
var port = 9000

var HttpResponseHeader = Java.type("org.parosproxy.paros.network.HttpResponseHeader")
var extensionNetwork = control.getExtensionLoader().getExtension("ExtensionNetwork")
var server

function messageHandler(ctx, msg) {
    ctx.overridden()

    msg.setResponseHeader(new HttpResponseHeader("HTTP/1.1 200\r\nConnection: close"))
}

function install(helper) {
    server = extensionNetwork.createHttpServer(messageHandler)
    server.start(address, port)
}

function uninstall(helper) {
    server.stop()
}

@ArkaprabhaChakraborty
Copy link
Contributor Author

You need to specify the method and wordlist right? :)

@thc202
Copy link
Member

thc202 commented Apr 22, 2023

It's using the defaults, GET and Predefined.

@ArkaprabhaChakraborty
Copy link
Contributor Author

ArkaprabhaChakraborty commented Apr 23, 2023

There are some exceptions when using the header guesser, e.g.:

[ZAP-ParamGuesser-0-thread-2] ERROR org.zaproxy.addon.paramdigger.HeaderGuesser - java.lang.NullPointerException
java.lang.NullPointerException: null
	at org.zaproxy.addon.paramdigger.HeaderGuesser.checkFirstRequestPoisoning(HeaderGuesser.java:320) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.forwardTemplate(HeaderGuesser.java:218) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.forwardingHeaderGuess(HeaderGuesser.java:182) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.startGuess(HeaderGuesser.java:164) ~[?:?]
	at org.zaproxy.addon.paramdigger.HeaderGuesser.run(HeaderGuesser.java:132) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	at java.lang.Thread.run(Thread.java:829) ~[?:?]

While the patch for this is underway... I noticed a miss in my detection but couldn't pinpoint why it is happening..
Request through Param Digger:

GET https://005a3c92.poison.digi.ninja:2443/basic.php HTTP/1.1
X-Forwarded-Host: 9549327
Host: 005a3c92.poison.digi.ninja:2443

Response with no seeming reflection:

HTTP/1.1 200 OK
Date: Sun, 23 Apr 2023 13:57:56 GMT
Server: Apache
Strict-Transport-Security: max-age=63072000
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=UTF-8
X-Varnish: 7005808 1525956
Age: 3
Via: 1.1 varnish (Varnish/6.5)
Accept-Ranges: bytes
Content-Length: 1036
Referrer-Policy: no-referrer-when-downgrade

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Basic - Cache Poisoning Lab</title>
	<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> 
	<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
	<meta property="og:title" content="Basic Poisoning Lab" />
	<meta property="og:type" content="website" />
	<meta property="og:image" content="http://005a3c92.poison.digi.ninja:2443/cms/social.png" />
</head>
<body>
	<h1>Basic Poisoning Lab</h1>
	<p>A random number is: 7045530</p>
	<p>
		This page loads its open graph image based on the host requested but isn't that clever when working out the host to use.
	</p>
	<p>
		Use this weakness to poison every visitor with a nice bit of Cross-Site Scripting.
	</p>
	<p><a href="/index.php">&laquo; Back to home</a></p>
	<hr />
	<p>
		Lab created by Robin Wood - <a href="https://digi.ninja">DigiNinja</a>
	</p>
</body>
</html>

But when I send the same using the requester tab/ manually. I get a reflection (<meta property="og:image" content="http://9549327/cms/social.png" />):
Response:

HTTP/1.1 200 OK
Date: Sun, 23 Apr 2023 14:02:08 GMT
Server: Apache
Strict-Transport-Security: max-age=63072000
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=UTF-8
X-Varnish: 1525959
Age: 0
Via: 1.1 varnish (Varnish/6.5)
Accept-Ranges: bytes
Content-Length: 1015
Referrer-Policy: no-referrer-when-downgrade

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Basic - Cache Poisoning Lab</title>
	<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> 
	<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
	<meta property="og:title" content="Basic Poisoning Lab" />
	<meta property="og:type" content="website" />
	<meta property="og:image" content="http://9549327/cms/social.png" />
</head>
<body>
	<h1>Basic Poisoning Lab</h1>
	<p>A random number is: 1673380440</p>
	<p>
		This page loads its open graph image based on the host requested but isn't that clever when working out the host to use.
	</p>
	<p>
		Use this weakness to poison every visitor with a nice bit of Cross-Site Scripting.
	</p>
	<p><a href="/index.php">&laquo; Back to home</a></p>
	<hr />
	<p>
		Lab created by Robin Wood - <a href="https://digi.ninja">DigiNinja</a>
	</p>
</body>
</html>

Edit: I forgot to mention I did find a reflection on the same tag with the Host Header successfully with the add-on :). Don't know if it can be exploited tho.
Edit 2: I think I may have found the rookie mistake :).
Lab credits: @digininja

@ArkaprabhaChakraborty
Copy link
Contributor Author

I think I'm missing some configuration for HttpSender() but not sure why :)... Can be a rookie mistake tho :)

@kingthorin
Copy link
Member

Re: Edit 2, so it did work in the end? Or you think you’ve identified the potential discrepancy?

@ArkaprabhaChakraborty
Copy link
Contributor Author

ArkaprabhaChakraborty commented Apr 23, 2023

Working out a fix to the rookie mistake. The cache controller needs a Fastly/Varnish Caching patch :) which I'm incorporating into the fix.

@ArkaprabhaChakraborty
Copy link
Contributor Author

I had a "PURGE" and "FASTLYPURGE" logic which is interfering in the detection :)

@ArkaprabhaChakraborty
Copy link
Contributor Author

More context:
Request:

PURGE https://005a3c92.poison.digi.ninja:2443/basic.php?fcbz=1 HTTP/1.1
Host: 005a3c92.poison.digi.ninja:2443

Response (No X-Varnish Header and no Age Header as well):

HTTP/1.1 200 OK
Date: Sun, 23 Apr 2023 15:04:32 GMT
Server: Apache
Strict-Transport-Security: max-age=63072000
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
Content-Type: text/html; charset=UTF-8
Referrer-Policy: no-referrer-when-downgrade
content-length: 1038

After this, I'm stupidly checking for caching... :)

@digininja
Copy link

digininja commented Apr 23, 2023 via email

@ArkaprabhaChakraborty
Copy link
Contributor Author

Thanks @digininja! But your 4-year-old work isn't that bad tho :).

@ArkaprabhaChakraborty
Copy link
Contributor Author

Fixed... all it needed was some sleepy time to detect the caching :P

@double16
Copy link

The requests used by paramdigger are missing a lot of headers from the original request.

Original request:

GET http://manager.htb/search.html HTTP/1.1
host: manager.htb
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Connection: keep-alive
Upgrade-Insecure-Requests: 1

paramdigger request:

GET http://manager.htb/search.html?zap=123 HTTP/1.1
host: manager.htb

On a bug bounty I'm working, the missing headers are triggering cloudfront to deny the requests.

@ArkaprabhaChakraborty
Copy link
Contributor Author

ArkaprabhaChakraborty commented Feb 15, 2024 via email

@double16
Copy link

When using the context menu on a request to attack using paramdigger, it seems reasonable for the user to expect the attack requests will look as much like the original request as reasonable. Configuring these headers before running paramdigger isn't the best experience, especially if they include things like session cookies.

Is there a reason why the original request headers aren't included?

@kingthorin
Copy link
Member

@ArkaprabhaChakraborty had there been a reason for removing all the request headers?

@ArkaprabhaChakraborty
Copy link
Contributor Author

ArkaprabhaChakraborty commented Feb 17, 2024 via email

@kingthorin
Copy link
Member

Thanks, I'll look at adding a button or something.

@kingthorin kingthorin self-assigned this Feb 18, 2024
@kingthorin kingthorin added the In:paramdigger Items pertaining to the Param Digger add-on. label Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add-on In:paramdigger Items pertaining to the Param Digger add-on. tracker
Development

No branches or pull requests

5 participants