/

CVE-2026-47687

Severity:

HIGH RISK

(7.3)

Stored XSS (CWE-79) in FOG Inventory Report Helper

CVE-2026-47687

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting in Admin Interface

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A stored cross-site scripting flaw in FOG's inventory report helper allows unescaped user-supplied data to be rendered inside HTML <option> labels.

An attacker who can submit crafted inventory data for a known host MAC address can persist a JavaScript payload that executes in an administrator's browser when viewing Reports > Inventory.

Affected context

The vulnerability manifests in FOG deployments where inventory data submitted via /service/inventory.php is rendered in the web UI without proper HTML escaping.

Specifically, the selectForm() helper in fogpage.class.php uses raw sysproduct values inside <option> elements for the Reports > Inventory page.

Environments with reachable inventory endpoints and active web-based administration workflows are most exposed.

Exploit preconditions

  • Attack surface: HTTP POST requests to /service/inventory.php on the FOG server
  • Required access: Ability to send unauthenticated requests and knowledge of at least one registered host's MAC address
  • Trigger point: An administrator opens the Reports > Inventory page, causing the stored payload to be rendered and executed
  • Why exploitation is possible: The selectForm() helper inserts unescaped sysproduct values into <option> labels, allowing attacker-controlled content to break out of the element and inject arbitrary JavaScript

Why this happens

The underlying issue is improper neutralization of user input before it is included in HTML output, aligning with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

The selectForm() helper in fogpage.class.php treats the sysproduct field as trusted data, inserting it directly into <option> tags without HTML encoding or sanitization.

When user-controlled strings are embedded in the DOM in this way, attackers can craft values that close existing tags and introduce <script> or event-handler attributes, leading to persistent XSS whenever the affected page is rendered.

Potential impact

  • Attacker-controlled JavaScript may execute in the administrator's browser
  • Session cookies and authentication tokens could be accessed or exfiltrated
  • Administrative actions can be spoofed or forced via UI redressing or script-driven requests
  • Configuration data, inventory records, and host management operations may be modified
  • Further compromise of managed hosts is possible through malicious admin-initiated workflows

General mitigation guidance

Effective mitigation focuses on enforcing strict output encoding and minimizing trust in any user-supplied content.

Common defensive patterns include:

  • Applying context-appropriate HTML encoding to all dynamic values rendered into markup, especially inside attribute and element content
  • Treating inventory fields such as sysproduct as untrusted input regardless of source and ensuring they pass through a safe templating or escaping layer
  • Using frameworks or templating engines that are secure-by-default and prevent raw HTML insertion unless explicitly allowed
  • Separating data from presentation logic so helpers like selectForm() never concatenate raw strings into HTML
  • Limiting browser-side privileges through hardened admin sessions and optional content security policies to reduce impact if a script is injected

How teams detect issues like this

Detection typically relies on a mix of automated and manual review techniques:

  • Static analysis rules that flag direct concatenation of request or database-derived variables into HTML strings
  • Code review checklists that require verification of output encoding for all user-controlled fields rendered in views, particularly select boxes, tables, and report pages
  • Security linters or automated scanning tools configured to detect patterns of unescaped output in PHP templates and helper classes
  • Application-level XSS tests targeting inventory and reporting endpoints, including attempts to inject markup and script tags via fields like sysproduct
  • Policy enforcement in CI/CD pipelines that block changes introducing raw HTML rendering without explicit justification

Sources

SourceLink
github.comgithub.com/FOGProject/fogproject/security/advisories/GHSA-hg23-3w27-2rf2

Frequently asked

questions

Exploitation is limited to environments where attackers can reach the FOG inventory service and know a registered host's MAC address, but once those conditions are met, the attack can reliably target any administrator who views the Inventory report.

The issue can be exploited without authentication, provided the attacker can send POST requests to /service/inventory.php and possesses a valid MAC address associated with a host in the FOG system.

The most robust fix is to ensure that all user-supplied data is encoded according to its output context, preferably by routing all HTML generation through templating systems that escape values by default and prohibit direct concatenation of raw data into markup.

Future prevention should combine strict output-encoding practices, security-focused code review, use of secure-by-default UI frameworks, and automated checks for unescaped variables in view logic, supplemented by optional browser defenses such as Content Security Policy to limit the impact of any remaining injection paths.

Find out what's already
exploitable in your codebase.