Summary
css_parser can make HTTP and HTTPS requests to attacker-selected destinations when it processes attacker-influenced CSS with a base URI. Because the parser does not sufficiently restrict schemes, hosts, ports, redirects, or private address ranges, an attacker may reach internal services and, through a redirect to a file URI, disclose local files.
css_parser can make HTTP and HTTPS requests to attacker-selected destinations when it processes attacker-influenced CSS with a base URI. Because the parser does not sufficiently restrict schemes, hosts, ports, redirects, or private address ranges, an attacker may reach internal services and, through a redirect to a file URI, disclose local files.
Affected context
The issue affects applications that use css_parser to process CSS containing attacker-controlled or insufficiently trusted content while supplying a base_uri option. Risk is higher when the parser follows imports or remote resources, runs in an environment with access to internal services, or can read sensitive local files. The exposure depends on how the consuming application obtains CSS and what network and filesystem permissions are available to the process.
The issue affects applications that use css_parser to process CSS containing attacker-controlled or insufficiently trusted content while supplying a base_uri option. Risk is higher when the parser follows imports or remote resources, runs in an environment with access to internal services, or can read sensitive local files. The exposure depends on how the consuming application obtains CSS and what network and filesystem permissions are available to the process.
Exploit preconditions
- Attack surface: CSS parsing and remote resource loading through
CssParser::Parser#read_remote_file,load_uri!, or import handling - Required access: Ability to supply or influence CSS content and have it processed with a usable
base_uri - Trigger point: Resolution of a remote resource or
@importduring parsing - Why exploitation is possible: Destination schemes, hosts, ports, redirects, and protected IP ranges are not sufficiently constrained, and redirects may be processed recursively, including redirects to local file resources
- Attack surface: CSS parsing and remote resource loading through
CssParser::Parser#read_remote_file,load_uri!, or import handling - Required access: Ability to supply or influence CSS content and have it processed with a usable
base_uri - Trigger point: Resolution of a remote resource or
@importduring parsing - Why exploitation is possible: Destination schemes, hosts, ports, redirects, and protected IP ranges are not sufficiently constrained, and redirects may be processed recursively, including redirects to local file resources
Why this happens
The underlying bug is an insufficiently constrained server-side URL fetching workflow. The parser treats attacker-influenced resource references as trusted locations, without enforcing a scheme allowlist, validating resolved destinations against loopback, link-local, and private address ranges, or safely limiting redirects. Recursive redirect handling also permits a network request to transition into local file access. This behavior maps to CWE-918: Server-Side Request Forgery, with local file disclosure arising as a related consequence of unsafe URI handling.
The underlying bug is an insufficiently constrained server-side URL fetching workflow. The parser treats attacker-influenced resource references as trusted locations, without enforcing a scheme allowlist, validating resolved destinations against loopback, link-local, and private address ranges, or safely limiting redirects. Recursive redirect handling also permits a network request to transition into local file access. This behavior maps to CWE-918: Server-Side Request Forgery, with local file disclosure arising as a related consequence of unsafe URI handling.
Potential impact
- An attacker may access cloud metadata services or other internal endpoints
- Internal network services may be probed or queried
- Authentication material or sensitive service responses could be disclosed
- Local files readable by the application process may be exposed
- Redirect chains could bypass intended network or scheme restrictions
- Network segmentation and trust boundaries may be weakened
- An attacker may access cloud metadata services or other internal endpoints
- Internal network services may be probed or queried
- Authentication material or sensitive service responses could be disclosed
- Local files readable by the application process may be exposed
- Redirect chains could bypass intended network or scheme restrictions
- Network segmentation and trust boundaries may be weakened
General mitigation guidance
Mitigation generally focuses on reducing trust in CSS-referenced resources and enforcing destination-aware URL handling.
Common defensive patterns include:
- Permit only explicitly required URI schemes, commonly limited to HTTPS where remote retrieval is necessary
- Resolve and validate every redirect destination before following it
- Block loopback, link-local, private, multicast, unspecified, and other restricted address ranges after DNS resolution
- Apply host, port, protocol, response-size, timeout, and redirect-count allowlists or limits
- Disable remote imports and external resource loading when the application does not require them
- Prevent file URI access and isolate resource-fetching components from sensitive filesystem paths
- Run the parser with least-privilege network and filesystem permissions
- Prefer fetching approved resources through a controlled proxy or dedicated retrieval service
Mitigation generally focuses on reducing trust in CSS-referenced resources and enforcing destination-aware URL handling.
Common defensive patterns include:
- Permit only explicitly required URI schemes, commonly limited to HTTPS where remote retrieval is necessary
- Resolve and validate every redirect destination before following it
- Block loopback, link-local, private, multicast, unspecified, and other restricted address ranges after DNS resolution
- Apply host, port, protocol, response-size, timeout, and redirect-count allowlists or limits
- Disable remote imports and external resource loading when the application does not require them
- Prevent file URI access and isolate resource-fetching components from sensitive filesystem paths
- Run the parser with least-privilege network and filesystem permissions
- Prefer fetching approved resources through a controlled proxy or dedicated retrieval service
How teams detect issues like this
Organizations can look for:
- Static analysis findings involving unrestricted URI fetching, recursive redirects, or file URI support
- Code review signals such as parser APIs receiving attacker-controlled CSS and a base URI
- Missing scheme, hostname, port, DNS-rebinding, and private-address validation
- Network telemetry showing parser processes contacting loopback, link-local, private, or metadata endpoints
- Requests for unusual ports, unexpected redirect chains, or local file access during CSS processing
- Policy checks requiring centralized outbound request controls and restricted egress for parsing workloads
Automated code review and dependency analysis tools may help identify risky URL-loading paths, but runtime network monitoring remains useful for detecting missed cases.
Organizations can look for:
- Static analysis findings involving unrestricted URI fetching, recursive redirects, or file URI support
- Code review signals such as parser APIs receiving attacker-controlled CSS and a base URI
- Missing scheme, hostname, port, DNS-rebinding, and private-address validation
- Network telemetry showing parser processes contacting loopback, link-local, private, or metadata endpoints
- Requests for unusual ports, unexpected redirect chains, or local file access during CSS processing
- Policy checks requiring centralized outbound request controls and restricted egress for parsing workloads
Automated code review and dependency analysis tools may help identify risky URL-loading paths, but runtime network monitoring remains useful for detecting missed cases.

