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.phpon 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 unescapedsysproductvalues 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
sysproductas 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

