Skip to content
Access control Write-up Intermediate

Security Vulnerabilities in CasaOS

CasaOS had an authentication bypass where an invalid X-Forwarded-For header caused the gateway to be treated as localhost, and a JWT secret was empty, allowing attackers to forge tokens. Attackers could gain full dashboard access and execute arbitrary commands on the host.

Thomas Chauchefoin Follow

Published on sonarsource.com

As part of our continuous effort to improve our Code Quality technology and the security of the open-source ecosystem, our R&D team is always on the lookout for new 0-day security vulnerabilities in prominent software.

Thomas Chauchefoin (@swapgs), on sonarsource.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 gateway forwarded an invalid X-Forwarded-For header, causing the backend to fall back to the gateway's IP (localhost) and skip authentication; additionally, the JWT secret was empty, allowing token forgery.

Impact

Attackers could bypass authentication, access stored data, and execute arbitrary commands to gain persistent access and pivot into internal networks.

What the attacker needed

Network access to CasaOS instance

The fix

The gateway was patched to rewrite X-Forwarded-For headers to never contain localhost addresses, and JWT validation was enforced using the configuration's private key.

How it was found

  1. Send a request without X-Forwarded-For header, receive 401 error.
  2. Send a request with an invalid X-Forwarded-For header, get through authentication.
  3. Use the access to reach the dashboard and execute commands.

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.

CasaOS is a personal cloud server. Two flaws let attackers log in without a password: one tricked the server into thinking the request came from the same machine, and another let attackers create fake login tokens because the secret key was blank. Once in, they could run commands and access files.

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 Thomas Chauchefoin

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.