# CSPT the Eval Villain Way!

DevFeed: [CSPT the Eval Villain Way!](<https://devfeed.tech/articles/cspt-the-eval-villain-way-92054.md>)

Original publisher: [Read original article](<https://blog.doyensec.com/2024/12/03/cspt-with-eval-villain.html>)

Published: 2024-12-02T23:00:00Z

Content type: tutorial

Language: en

Sources: [Doyensec](<https://devfeed.tech/sources/doyensec.md>)

Topics: [Tool](<https://devfeed.tech/topics/tool.md>), [Firefox](<https://devfeed.tech/topics/firefox.md>), [fetch](<https://devfeed.tech/topics/fetch.md>), [Tutorial](<https://devfeed.tech/topics/tutorial.md>)

Tags: [auditing](<https://devfeed.tech/tags/auditing.md>), [automation](<https://devfeed.tech/tags/automation.md>), [docker](<https://devfeed.tech/tags/docker.md>), [doyensec](<https://devfeed.tech/tags/doyensec.md>), [doyensecurity](<https://devfeed.tech/tags/doyensecurity.md>), [eval](<https://devfeed.tech/tags/eval.md>), [exploit](<https://devfeed.tech/tags/exploit.md>), [exploit-chain](<https://devfeed.tech/tags/exploit-chain.md>), [fetch](<https://devfeed.tech/tags/fetch.md>), [firefox](<https://devfeed.tech/tags/firefox.md>), [hacking](<https://devfeed.tech/tags/hacking.md>), [http](<https://devfeed.tech/tags/http.md>), [infosec](<https://devfeed.tech/tags/infosec.md>), [instrumentation](<https://devfeed.tech/tags/instrumentation.md>), [offensive](<https://devfeed.tech/tags/offensive.md>), [pentest](<https://devfeed.tech/tags/pentest.md>), [pentester](<https://devfeed.tech/tags/pentester.md>), [playground](<https://devfeed.tech/tags/playground.md>), [redirect](<https://devfeed.tech/tags/redirect.md>), [research](<https://devfeed.tech/tags/research.md>), [reverse-engineering](<https://devfeed.tech/tags/reverse-engineering.md>), [security](<https://devfeed.tech/tags/security.md>), [url](<https://devfeed.tech/tags/url.md>), [vulnerability](<https://devfeed.tech/tags/vulnerability.md>), [web-app](<https://devfeed.tech/tags/web-app.md>)

## AI overview

The article demonstrates how Eval Villain traces a client-side request path into a CSPT2CSRF chain: an encoded traversal reaches a GET fetch, its response is added to the source bank with evSourcer, and a returned _id reaches an authenticated POST fetch. The walkthrough uses Firefox and the CSPT playground, enables Path search and evSourcer, instruments the response with an evSinker conditional breakpoint, then enables object inspection to reveal fetch options. The first request follows redirects, making an open redirect part of the demonstrated route to a researcher-controlled response. Eval Villain can also be copied into other JavaScript environments, including an instrumented Electron app. The article notes it cannot decode every case; it suggests combining tools, with Maxence's Burp extension offering less DOM insight, and names Geko, DOMLogger++ and DOM Invader as alternatives.

## Source excerpt

Doyensec's Maxence Schmitt recently built a playground to go with his CSPT research. In this blog post, we will demonstrate how to find and exploit CSPT bugs with Eval Villain. For this purpose, we will leverage the second challenge of Maxence's playground. A step-by-step intro to CSPT with Eval Villain The next image shows what this methodology yields. We've added some boxes and arrows in orange to better illustrate the current situation. First, Eval Villain saw that part of the page's path is being used in a fetch request. There, you can plainly see the asdf%2f.. was being URL decoded. Or if you prefer, you can expanded the "Encoder function" group to check. Either way, Eval Villain had discovered the CSPT sink. The second square is on top of a debug statement from evSourcer. This was where the response from the first fetch was being added to Eval Villain's source bank. As a result, Eval Villain warned us that the _id parameter from the CSPT response had hit another fetch sink. Again, you could get a bit more details from the "Encoder function". From the arg[2/2] of each fetch we learned more. The first fetch is a GET that had "redirect":"follow" and the second had "method":"POST". So we controlled the path of a client-side GET request and an open redirect could have sent that request to our own server. The response of our own server would have then been used in the path of an authenticated POST request. This one image shows the entire exploit chain for a CSPT2CSRF exploit. All of this instrumentation stays around to help us with our exploit. Clicking the provided solution we see the following image. This shows exactly how the exploit works. Building the picture yourself Step 0: Tools You will need Firefox with Eval Villain installed. You'll also need the CSPT playground, which runs in Docker via docker compose up. This should bring up a vulnerable web app on http://127.0.0.1:3000/. Read the README.md for more info. We really do recommend trying this out in the pl