Skip to content

Security: Potential Cross-Site Scripting (XSS) via HTML Attribute Injection#1658

Open
tomaioo wants to merge 1 commit into
18F:developfrom
tomaioo:fix/security/potential-cross-site-scripting-xss-via-h
Open

Security: Potential Cross-Site Scripting (XSS) via HTML Attribute Injection#1658
tomaioo wants to merge 1 commit into
18F:developfrom
tomaioo:fix/security/potential-cross-site-scripting-xss-via-h

Conversation

@tomaioo

@tomaioo tomaioo commented Jun 19, 2026

Copy link
Copy Markdown

Summary

Security: Potential Cross-Site Scripting (XSS) via HTML Attribute Injection

Problem

Severity: Medium | File: _includes/historical_data_download.html:L10

In _includes/footer.html, the site.baseurl is interpolated into an HTML attribute without explicit escaping. While Jekyll typically escapes output by default, the use of double quotes around the attribute value relies on proper escaping. If site.baseurl ever contains malicious content or if the template engine's escaping behavior changes, this could lead to attribute injection. More critically, in _includes/historical_data_download.html and _includes/visualizations.html, the agencies data is passed via JSON through Jekyll's jsonify filter into HTML attributes using single quotes. The jsonify filter may not sufficiently escape content for HTML attribute contexts, particularly if agency names contain single quotes or other special characters, potentially breaking out of the attribute context and enabling XSS.

Solution

Ensure all dynamic content inserted into HTML attributes is properly escaped for the HTML attribute context. Consider using data-* attributes with URL-encoded or base64-encoded JSON, or ensure the jsonify filter properly escapes single quotes and other HTML-sensitive characters. Add explicit HTML escaping where Jekyll's default escaping might be bypassed.

Changes

  • _includes/historical_data_download.html (modified)

In _includes/footer.html, the site.baseurl is interpolated into an HTML attribute without explicit escaping. While Jekyll typically escapes output by default, the use of double quotes around the attribute value relies on proper escaping. If site.baseurl ever contains malicious content or if the template engine's escaping behavior changes, this could lead to attribute injection. More critically, in _includes/historical_data_download.html and _includes/visualizations.html, the agencies data is passed via JSON through Jekyll's jsonify filter into HTML attributes using single quotes. The jsonify filter may not sufficiently escape content for HTML attribute contexts, particularly if agency names contain single quotes or other special characters, potentially breaking out of the attribute context and enabling XSS.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant