{"id":"GHSA-33gv-fc78-qgf5","summary":"YAFNET has Unauthenticated Stored Second-Order XSS in Admin Event Log via Reflected `User-Agent` Header","details":"**Description:**\nStored (second-order) Cross-Site Scripting (XSS) occurs when attacker-controlled input is persisted through one component of an application and later rendered, without proper sanitization or contextual output encoding, by a completely different component — often one that implicitly trusts the stored data. Because the dangerous sink is typically a privileged administrative interface, the payload executes in the browser of a high-value user (such as an administrator) and inherits their authenticated session. This class of issue is especially severe when the entry point is an HTTP header on an unauthenticated endpoint, since the attack surface extends to any anonymous attacker on the internet with no prerequisites.\n\n**Issue Details:**\nThe application's database logger (`YAFNET.Core/Logger/DbLogger.cs`) captures the incoming request's `User-Agent` header into a `JObject`, serializes it with `JsonConvert`, and stores the result in the `EventLog.Description` column whenever an event (e.g., an unhandled exception) is logged. The admin event-log page (`YetAnotherForum.NET/Pages/Admin/EventLog.cshtml.cs`) later deserializes that JSON in `FormatStackTrace()` and interpolates the `UserAgent` value directly into an HTML string with no encoding, and the Razor view `EventLog.cshtml` emits the result through `@Html.Raw`. Critically, the attacker does not need to be authenticated: the unauthenticated endpoint `GET /api/Attachments/GetAttachment?attachmentId=2147483647` reliably triggers a server-side exception that is written to `dbo.EventLog` together with the attacker-controlled `User-Agent`. A single anonymous request such as `curl -A \"\u003cimg src=x onerror=alert('XSS')\u003e\" \"http://\u003ctarget\u003e/api/Attachments/GetAttachment?attachmentId=2147483647\"` is sufficient to persist the payload, and when an administrator later visits `/Admin/EventLog` the malicious markup is rendered as live HTML in the admin's authenticated session.\n\n**Impact:**\nAn entirely unauthenticated attacker, with no account, no CSRF token, and no prior access, can stage JavaScript that will execute in an administrator's browser the next time the Event Log is viewed. Because the script runs in the admin's authenticated origin, it can perform any action the admin can: creating new administrative accounts, modifying site-wide settings, exfiltrating user data through admin-only endpoints. This effectively converts a single anonymous HTTP request into a full forum-takeover primitive, and the lack of any authentication requirement makes it exploitable at internet scale, including by automated scanners.\n\n**Likelihood:**\nExploitation requires only the ability to send a single HTTP request to a public, unauthenticated endpoint, which any anonymous attacker on the internet can do. Administrators routinely review the Event Log as part of normal operations, so payload delivery is highly probable with negligible attacker effort, making the overall likelihood very high.\n\n**Steps to Reproduce:**\n- From an unauthenticated session (no cookies, no tokens), send the following request with a malicious `User-Agent` header:\n  - `curl.exe -sS -A \"\u003cimg src=x onerror=alert('XSS')\u003e\" \"http://yetanotherforum.internal:8080/api/Attachments/GetAttachment?attachmentId=2147483647\"`\n- Confirm the server returns an error response and that a row has been written to `dbo.EventLog` containing the attacker-controlled `UserAgent` value inside the JSON `Description`.\n- As an administrator (e.g., `Superuser`), navigate to `/Admin/EventLog`.\n- Observe that the rendered page contains the raw `\u003cimg src=x onerror=\"alert('XSS')\"\u003e` element inside the event's badge block, and that the `onerror` handler executes in the admin's authenticated session, confirming cross-session, cross-privilege script execution from an unauthenticated source.\n\n\u003cimg width=\"1193\" height=\"809\" alt=\"image\" src=\"https://github.com/user-attachments/assets/70c59ef2-8d31-435b-9a9d-338f753e58f8\" /\u003e","aliases":["CVE-2026-43938"],"modified":"2026-05-05T20:50:03.181461Z","published":"2026-05-05T20:31:36Z","database_specific":{"github_reviewed_at":"2026-05-05T20:31:36Z","cwe_ids":["CWE-116","CWE-79","CWE-80"],"github_reviewed":true,"nvd_published_at":null,"severity":"HIGH"},"references":[{"type":"WEB","url":"https://github.com/YAFNET/YAFNET/security/advisories/GHSA-33gv-fc78-qgf5"},{"type":"PACKAGE","url":"https://github.com/YAFNET/YAFNET"},{"type":"WEB","url":"https://github.com/YAFNET/YAFNET/releases/tag/v3.2.12"},{"type":"WEB","url":"https://github.com/YAFNET/YAFNET/releases/tag/v4.0.5"}],"affected":[{"package":{"name":"YAFNET.Core","ecosystem":"NuGet","purl":"pkg:nuget/YAFNET.Core"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.0.0-beta01"},{"fixed":"4.0.5"}]}],"versions":["4.0.0","4.0.0-beta03","4.0.0-beta04","4.0.0-beta05","4.0.0-beta06","4.0.0-beta07","4.0.0-beta08","4.0.0-beta09","4.0.0-rc01","4.0.0-rc02","4.0.0-rc03","4.0.0-rc04","4.0.1","4.0.2","4.0.3","4.0.4"],"database_specific":{"last_known_affected_version_range":"\u003c= 4.0.4","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-33gv-fc78-qgf5/GHSA-33gv-fc78-qgf5.json"}},{"package":{"name":"YAFNET.Core","ecosystem":"NuGet","purl":"pkg:nuget/YAFNET.Core"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.2.12"}]}],"database_specific":{"last_known_affected_version_range":"\u003c= 3.2.11","source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/05/GHSA-33gv-fc78-qgf5/GHSA-33gv-fc78-qgf5.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"}]}