Skip to content
CSRF Disclosed report Intermediate

Cross-Site Request Forgery

The application fails to enforce CSRF tokens on most requests, allowing an attacker to perform actions on behalf of a logged-in victim. An attacker could create a new admin account or share files with a controlled user if the victim visits a malicious website.

pascal_geuter Follow

Originally disclosed on HackerOne

High 7.5 View original
  • Triaged in 5 days
  • Fixed in 15 days
  • Disclosed after 4 months

The application does not throw a CrossSiteRequestForgeryException, if the request does not contain the requesttoken header.

Steps to reproduce

  • run the docker image "owncloud/server:10.12.2" , redis and mariadb with docker-compose
  • log in the application as an admin user
  • insert your cookies in
Bash
curl 'http://localhost:8080/settings/users/users' \
  -H 'Accept: */*' \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' \
  -H 'Cookie: oc_sessionPassphrase=<placeholder1>; oclt1tejv3yd=<placeholder2>' \
  -H 'Origin: http://abc:8080' \
  --data-raw 'username=new_admin&groups%5B%5D=admin&password=a&email=test%40mail.com' \
  --compressed

and run it.

  • Login in the application with the username new_admin and the passwort a

To add an admin user is only an example. Most if not all requests does not require an CSRF token.

I think the cause of this vulnerability is the second condition of https://github.com/owncloud/core/blob/master/lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php#L145, because the the value of $this->request->getHeader("Authorization") is an empty string and not null, if there are no Authorization header.

Impact

Under the requirement, that the sameSite value of the cookies are set to lax or none, an attacker can create a website and if the victim surfs to this website cross site requests with the cookies of the victim are possible. Depending on the role/groups of the victim, the attacker can create an admin account with known username and passwort or share files with an other (possible attacker controlled) user and possible other actions.

The original report as published on HackerOne, by pascal_geuter. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

Likely the CSRF protection middleware incorrectly treats an empty Authorization header as present, bypassing the token check.

Impact

If the cookies' SameSite attribute is set to lax or none, an attacker can create a website that, when visited by a logged-in victim, performs actions such as creating an admin account or sharing files.

What the attacker needed

Victim is logged in; victim visits attacker's website; cookies SameSite set to lax or none

How it was found

  1. Start the application using the provided Docker image along with Redis and MariaDB.
  2. Log in as an admin user.
  3. Extract the session cookies from the browser.
  4. Send a crafted request to the user creation endpoint with the cookies and without a CSRF token.
  5. Log in with the newly created admin credentials to confirm the action succeeded.

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 report has not been written yet. The Original tab links to the source.

Cross-site request forgery (CSRF) is when a malicious website tricks your browser into sending a request to another site where you are logged in, without your knowledge. Here, the application did not check for a secret token that should accompany such requests, so an attacker could make your browser create a new admin account or share files.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More from ownCloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.