Skip to content
RCE Write-up Intermediate

Using Application Functionality to Exploit Insecure Deserialization

The application stored a serialized object in a session cookie that included a file path for the user's avatar. An attacker could modify this path to point to an arbitrary file and then use the account deletion endpoint to delete that file.

rcxsecurity Follow

Published on medium.com

Welcome back to another Lab Walkthrough at the Cybersec Cafe, where I detail my mindset as I approach a Web Application.

Ryan G. Cox, 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.

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

Likely the application deserialized a user-controlled cookie without integrity checks and used the deserialized file path in a file deletion function.

Impact

An attacker could delete arbitrary files on the server, potentially causing data loss or disrupting the application.

What the attacker needed

A valid user account; ability to intercept and modify requests

The fix

The application should avoid deserializing user-controlled data and should validate file paths before performing file operations.

How it was found

  1. Log in with the backup account and capture the avatar upload and account deletion requests.
  2. In the avatar upload request, decode the session cookie to see the serialized object containing avatar_link.
  3. Modify the avatar_link value to point to /home/carlos/morale.txt and update the length prefix accordingly.
  4. Change the request path from /my-account/avatar to /my-account/delete and send the request.
  5. The file is deleted and the lab is solved.

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.

When a website saves your data, it sometimes packs it into a string called a serialized object. If the website trusts that string without checking it, a user can change it to do things the website did not intend, like deleting a file on the server.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More by rcxsecurity

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.