A great place to start is the Scenarios section, followed by the Demonstrating the exploits section.
- CS5331
[ browser ] <===> [ proxy (HAProxy) ] <===> [ backend (Gunicorn) ]
-
Background:
backendhas a/protectedpage that is not meant to be accessible by the web browser as theproxymaps/protectedto/unauthorized. This means that requesting for/protectedvia theproxywill result in getting the contents of/unauthorizedfrom thebackend. -
Goal: View the contents of
/protectedpage.
-
Background:
backendhas a/redirectedpage which has anOpen Redirectvulnerability. It redirects the user based on theHostheader of the request. This cannot be exploited for phishing-related acts on a victim as there is no way to override theHostheader using normal means. -
Goal: Force a victim to be redirected to an arbitrary URL.
-
Background:
backendhas a/reflectedpage which has anReflected XSSvulnerability. It prints the contents of theUser-Agentheader of the request. This cannot be exploited to execute Javascript payloads on the victim as there is no way to override theUser-Agentheader using normal means. -
Goal: Force a victim to execute arbitrary Javascript code.
-
Background:
backendhas a/capturedpage that receivescontentfrom the body data of the request and stores it in an in-memory array, which can be viewed. -
Goal: Force a victim's next request (containing a
FLAGcookie) to be saved into the in-memory array.
- Gunicorn (Apparently this was not assigned a CVE???): https://grenfeldt.dev/2021/04/01/gunicorn-20.0.4-request-smuggling/
- HAProxy CVE-2021-40346: https://nvd.nist.gov/vuln/detail/CVE-2021-40346
./backend/*: Contains files to build thebackendcontainer./proxy/*: Contains files to build theproxycontainer./poc/*: Contains scripts to run attacks
- Make code changes
docker-compose builddocker-compose up- Repeat.
poc1.py: Exploits Gunicorn's vulnerability to poison the next user's requestpoc1_redirect.py: Exploits Gunicorn's vulnerability to force the user to be redirected tohttp://www.example.com.poc1_xss.py: Exploits Gunicorn's vulnerability to force the user's browser to executealert(document.domain).poc1_capture.py: Exploits Gunicorn's vulnerability to capture the next user's request and store it into the server's in-memory array
poc2.py: Exploits HAProxy's vulnerability to poison the next user's requestpoc2_redirect.py: Exploits HAProxy's vulnerability to force the user to be redirected tohttp://www.example.com.poc2_xss.py: Exploits HAProxy's vulnerability to force the user's browser to executealert(document.domain).poc2_capture.py: Exploits HAProxy's vulnerability to capture the next user's request and store it into the server's in-memory array
- Execute
python3 poc1.py. - Within the next 30s, browse to
http://localhost.
- Execute
python3 poc1_redirect.py. - Within the next 30s, browse to
http://localhost.
- Execute
python3 poc1_xss.py. - Within the next 30s, browse to
http://localhost.
- Execute
python3 poc1_capture.py. - Within the next 30s, execute the following:
curl http://localhost/ -H "Cookie: FLAG" - Browse to
http://localhost/captured.