Skip to content
Access control Write-up Advanced

Download Lfi Orm Injection Teletypewriter Tty Hijacking Postgresql

The web application used a signed cookie to store the user's identity, but the signing key was exposed in a publicly readable JavaScript file. An attacker could forge a cookie to impersonate other users, and by injecting Prisma query operators into the cookie's user object, could extract password hashes and take over accounts.

Aydin Naserifard Follow

Published on infosecwriteups.com

We can use the -fs flag to filter out HTTP responses based on their size. Specifically, we’re filtering responses that have a size of 178 bytes to limit false positives.

Aydin Naserifard, on infosecwriteups.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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The application used a hard-coded cookie signing secret that was exposed in a publicly accessible JavaScript file, and it passed user-controlled cookie data directly into Prisma queries without validation, allowing ORM injection.

Impact

An attacker could impersonate any user, access all users' files, and extract password hashes to crack and log in as other users, including administrative accounts.

What the attacker needed

A free account; access to the web application

How it was found

  1. Register and log in to the web application.
  2. Upload a file and observe the download request using a UUID.
  3. Decode the download_session cookie to see it contains user id and username.
  4. Discover the cookie signing secret by reading app.js via a local file read vulnerability.
  5. Use cookie-monster to forge a signed cookie with a different user id or username.
  6. Replace the cookie and access the home page to view other users' files.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The website stored who you are in a cookie, a small piece of data your browser sends back. It signed the cookie to prevent tampering, but the secret key used for signing was accidentally left in a file anyone could download. This let attackers create their own cookies and pretend to be other users, and even trick the database into revealing password hashes.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Aydin Naserifard

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.