Hugging Face Smolagents XPath injection vulnerability in the search_item_ctrl_f function
The search_item_ctrl_f function in Hugging Face Smolagents builds an XPath query by directly concatenating user input without escaping. An attacker could inject XPath syntax to alter the query logic, bypass search filters, access unintended DOM elements, and disrupt web automation workflows.
huggingface/smolagents
Originally disclosed on huntr
Hugging Face Smolagents version 1.20.0 contains an XPath injection vulnerability in the search_item_ctrl_f function located in src/smolagents/vision_web_browser.py. The function constructs an XPath query by directly concatenating user-supplied input into the XPath expression without proper sanitization or escaping. This allows an attacker to inject malicious XPath syntax that can alter the intended query logic. The vulnerability enables attackers to bypass search filters, access unintended DOM elements, and disrupt web automation workflows. This can lead to information disclosure, manipulation of AI agent interactions, and compromise the reliability of automated web tasks. The issue is fixed in version 1.22.0.
From the GitHub Advisory Database (GHSA-8mf9-rmgw-33qc, CC BY 4.0).
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The function concatenates user-supplied input directly into an XPath expression without sanitisation or escaping.
Impact
Attackers could bypass search filters, access unintended DOM elements, and disrupt web automation workflows, potentially leading to information disclosure and manipulation of AI agent interactions.
What the attacker needed
User-supplied input reaches the function
The fix
The issue was fixed in version 1.22.0.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
XPath is a language for picking elements out of a web page's structure. If a program pastes what a user types straight into an XPath query, the user can add extra XPath instructions that change which elements are selected. Here that let someone make the automation tool look at parts of the page it was not meant to, which could leak information or break the workflow.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.