Skip to content
UI spoofing Write-up Intermediate

ctrl+c & ctrl+v to Steal SESSIONID

An endpoint returned the session ID in its JSON response and lacked the X-Frame-Options header, so an attacker could frame the page and use a copy-paste game to steal the session ID. This could lead to account takeover.

Arbaz Hussain Follow

Published on medium.com

Bounty$100 View original

#### Arbaz Hussain

Arbaz Hussain, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is a web application whose main site is referred to as site.com. The researcher, Arbaz Hussain, spent two to three days brute-forcing directories and came across an endpoint that returned session information for the logged-in user:

Text
https://site.com/ping/ loggedIn

The response body contained the user's name and, more importantly, the value of the session cookie:

JSON
{
"type": "Ping",
"loggedIn": true,
"username": "arbazkiraak007",
"sessionId": "[redacted]-n3",
"instanceId": "i-3c2662af"
}

The sessionId field is the value carried in the SESSIONID cookie header, so a party able to read this response obtains a session identifier. The application had clickjacking protections on each and every endpoint, but this endpoint was missing the X-FRAME-OPTIONS header, which means it could be loaded inside an attacker-controlled frame.

The researcher then built a simple copy-and-paste game as a demonstration of stealing the SESSIONID. The report does not describe the mechanics of the game beyond that, and it does not include the page source.

The report rates severity as Medium, complexity as Medium, and names the weakness as a missing clickjacking header. A bounty of 100.00 USD was paid. The report does not describe a fix being applied.

Root cause

The root cause is twofold. First, the /ping/ endpoint echoes back the session cookie value in its response body. Second, that endpoint was left out of the application-wide clickjacking defence, so it lacks the X-FRAME-OPTIONS header that the rest of the site sends. Either mistake alone is a weakness; together they let an attacker frame the endpoint and trick the victim into copying the session value out.

Impact

An attacker who can convince a logged-in user to interact with a page they control could obtain that user's SESSIONID. The report demonstrates the theft through a copy-and-paste game.

How this kind of bug works

Clickjacking is a UI redress attack. The attacker loads the target page in a frame (an iframe, or a popup window) positioned under decoy content, so the victim believes they are clicking or typing into the attacker's page while their input lands on the framed target. The browser has no way to tell the difference: the framed page is genuinely the target origin, with the victim's cookies attached.

Defences work by telling the browser not to render the page in a frame. X-FRAME-OPTIONS: DENY forbids all framing; SAMEORIGIN allows framing only by pages of the same origin. The modern replacement is the Content-Security-Policy frame-ancestors directive, which can name allowed ancestors explicitly. A page that sends neither can be framed by anyone.

Framing alone is not usually enough to steal data, because the same-origin policy stops the attacker's script from reading the framed document. The bug becomes serious when the framed page either performs a sensitive state change on a click (a clickjacked action) or exposes secrets in a way the victim can be tricked into copying, as with the copy-and-paste game here. Endpoints that return tokens, session identifiers or personal data in the response body are valuable framing targets, because the attacker only needs the victim to copy the content out.

How to test for it

  1. Enumerate endpoints that return session material or other secrets in the body. Directory and file brute-forcing, as in this report, plus reading JavaScript bundles for API paths, are the usual ways to find them. Status, ping, debug and profile endpoints are common offenders.
  2. For each candidate, request it while authenticated and inspect the response headers for X-FRAME-OPTIONS and for a CSP frame-ancestors directive. A response with neither is framable.
  3. Confirm by loading the endpoint inside an iframe on a page from a different origin and checking that the content renders. Compare against a known-protected endpoint on the same site to show the inconsistency.
  4. Establish impact: show that the framed response contains a value that grants access (a session identifier, token or personal data) and describe the interaction needed to extract it. A screenshot of the framed page rendering cross-origin is the minimum evidence.

Common false positives: a missing header on a page that returns only static, non-sensitive content; a page that is framable but whose content the attacker cannot read or induce the victim to copy; and cases where the browser or an extension blocks third-party framing regardless of headers. Also check that the header is genuinely absent rather than set only on some responses, for example on errors or redirects.

How it is fixed

Send X-FRAME-OPTIONS: DENY or SAMEORIGIN on every response, including error pages and endpoints added later, ideally from a single middleware layer so new routes inherit it. Prefer adding Content-Security-Policy: frame-ancestors 'none' (or a specific allowlist) alongside it. Separately, stop returning session identifiers and other secrets in response bodies: a status endpoint should return a boolean or a generic message, never the cookie value. Rotating session identifiers and binding them to additional context reduces the value of a stolen one.

Hunting notes

This bug class hides at the edges of an application: endpoints added for monitoring, health checks, internal tooling or debugging that bypass the shared header middleware, and older paths that predate the site-wide protection. Recon signals include a site that consistently sends X-FRAME-OPTIONS on main pages but not on API or status paths, and JavaScript that references endpoints returning user objects. When you find a framable endpoint, check whether its body carries anything sensitive before reporting; a missing header alone is often triaged as informational. To make the report land, pair the header gap with a concrete extraction path and a working demonstration, as this report did with its copy-and-paste game.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 6 min read.

What happened, in plain words

A website is made of many pages and behind-the-scenes addresses called endpoints. When you log in, the site gives your browser a small piece of text called a session cookie. The browser sends that cookie back with every request, and the site uses it to recognise you. Anyone who copies that value holds the session identifier the site uses to recognise you.

Arbaz Hussain spent two to three days guessing folder and file names on the target site, a technique called directory brute-forcing: a tool tries thousands of common names in a row, like trying every key on a large key ring. This turned up an endpoint at:

Text
https://site.com/ping/ loggedIn

This endpoint answered with details about the logged-in user:

JSON
{
"type": "Ping",
"loggedIn": true,
"username": "arbazkiraak007",
"sessionId": "[redacted]-n3",
"instanceId": "i-3c2662af"
}

Line by line: type says what kind of answer this is; loggedIn confirms the request carried a valid session; username names the account; sessionId is the value of the SESSIONID cookie itself; instanceId is another field in the response. The important line is sessionId. The report states it is the value carried in the SESSIONID cookie header, so anyone who can read this response holds the session identifier.

A second gap mattered here. The site protected each and every endpoint against clickjacking, but this endpoint was missing the X-FRAME-OPTIONS header. Clickjacking is a trick where the attacker loads a real page from the target site inside a frame, a small window embedded in another page, and positions it under decoy content. You think you are clicking or typing on the attacker's page, but your input lands on the real site, with your cookies attached. The X-FRAME-OPTIONS header is the instruction that tells the browser "do not show this page inside a frame". Without it, any site can frame this endpoint.

The researcher built a simple copy-and-paste game to demonstrate stealing the SESSIONID. The report does not describe how the game works beyond that, and it does not include the page source.

The report rates severity as Medium, complexity as Medium, and names the weakness as a missing clickjacking header. A bounty of 100.00 USD was paid. The report does not describe a fix being applied.

In general, how this kind of bug works

Two separate mistakes combine here. The first is an endpoint that returns secrets in its response body instead of a plain yes or no. The second is a page that can be framed by anyone. Either one alone is a weakness; together they let an attacker's page display the real endpoint and persuade the victim to hand over what it shows.

Framing by itself does not let the attacker read the framed page. Browsers enforce the same-origin policy: scripts from one site cannot read the contents of a page from another site. That is why the attack needs the victim to do something, such as copy text out of the frame and paste it somewhere. The report demonstrates the theft with a copy-and-paste game.

How to test for it

  1. Look for endpoints that return session material or other secrets in the body. Directory brute-forcing, as in this report, plus reading the site's JavaScript files for API paths, are the usual ways. Status, ping, debug and profile endpoints are common offenders.
  2. For each candidate, request it while logged in and inspect the response headers for X-FRAME-OPTIONS and for a Content-Security-Policy frame-ancestors directive. A response with neither can be framed.
  3. Confirm by loading the endpoint inside an iframe on a page from a different origin and checking that the content renders. Compare against a known-protected endpoint on the same site to show the inconsistency.
  4. Establish impact: show that the framed response contains a value that grants access, such as a session identifier, token or personal data, and describe the interaction needed to extract it. A screenshot of the framed page rendering cross-origin is the minimum evidence.

Common false positives: a missing header on a page that returns only static, non-sensitive content; a page that is framable but whose content the attacker cannot read or induce the victim to copy; and cases where the browser or an extension blocks third-party framing regardless of headers. Also check that the header is genuinely absent rather than set only on some responses, for example on errors or redirects.

How it is fixed

Send X-FRAME-OPTIONS: DENY or SAMEORIGIN on every response, including error pages and endpoints added later, ideally from a single middleware layer so new routes inherit it. Prefer adding Content-Security-Policy: frame-ancestors 'none' (or a specific allowlist) alongside it. Separately, stop returning session identifiers and other secrets in response bodies: a status endpoint should return a boolean or a generic message, never the cookie value. Rotating session identifiers and binding them to additional context reduces the value of a stolen one.

Hunting notes

This bug class hides at the edges of an application: endpoints added for monitoring, health checks, internal tooling or debugging that bypass the shared header middleware, and older paths that predate the site-wide protection. Recon signals include a site that consistently sends X-FRAME-OPTIONS on main pages but not on API or status paths, and JavaScript that references endpoints returning user objects. When you find a framable endpoint, check whether its body carries anything sensitive before reporting; a missing header alone is often triaged as informational. To make the report land, pair the header gap with a concrete extraction path and a working demonstration, as this report did with its copy-and-paste game.

Glossary

  • Endpoint: a specific address on a website that returns data or performs an action, often not a page you would visit by hand.
  • Directory brute-forcing: automatically trying thousands of common folder and file names to discover hidden paths.
  • Session cookie: a small value the site stores in your browser after login and checks on each request to recognise you.
  • Session identifier: the value inside the session cookie; whoever holds it can act as the logged-in user.
  • Request: the message your browser sends to a server asking for a page or data.
  • Response: the message the server sends back, including headers and a body.
  • Response body: the actual content of the response, such as a page or a block of JSON data.
  • Header: a line of metadata sent with a request or response, separate from the visible content.
  • JSON: a text format for structured data, made of names and values in curly braces.
  • Clickjacking: tricking a user into clicking or typing on a real site hidden inside a frame on an attacker's page.
  • Frame / iframe: a small window embedded inside a web page that can display another page.
  • X-FRAME-OPTIONS: a response header that tells the browser whether the page may be shown inside a frame.
  • Content-Security-Policy: a response header that sets rules for a page, including which sites may frame it via frame-ancestors.
  • Same-origin policy: the browser rule that stops scripts from one site reading content from another site.
  • Middleware: a shared layer in a web application that processes every request, so a setting applied there covers all routes.
  • False positive: a finding that looks like a bug but has no real security impact.
  • Severity: a rating of how serious a bug is.
  • Complexity: a rating of how hard the bug is to find or exploit.
  • Bounty: a payment made by a company to a researcher who reports a valid bug.

More by Arbaz Hussain

View all

14 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Clickjacking and UI spoofing

The lesson behind this report.

The interface lies to the user: a framed page catches their clicks, or a browser shows the wrong address or a fake prompt. Paid when it leads to a sensitive action or convincing phishing.