T09 · Insecure Skill Coding Practices
- Location
assets/template.html:686- Finding
Unvalidated URL Schemes in Generated Booking Links
- Content
View full analysis
`${esc(l.name)}`).join(""); ``` The same pattern is used for hotel links: ```javascript const links = (h.links || []).map(l => `${esc(l.name)}`).join(""); ``` ### Technical Analysis The `esc()` function performs HTML metacharacter escaping: ```javascript const esc = (s) => (s == null ? "" : String(s)).replace(/[&<>"]/g, c => ({ "&":"&","<":"<",">":">",'"':""" }[c])); ``` However, HTML escaping does not validate the semantic safety of a URL. A value using an executable or otherwise dangerous scheme, such as `javascript:`, can remain valid after escaping. The template expects travel research results and generated itinerary data to populate `DATA.transport[].links` and `DATA.hotels[].links`. If an attacker-controlled or incorrectly generated URL reaches either field, it is inserted directly into an anchor's `href` attribute. `target="_blank"` and `rel="noopener"` mitigate opener-based attacks but do not prevent execution of a dangerous URL scheme. ### Attack Path 1. An attacker controls or poisons a travel search result, booking recommendation, or other source used to construct the itinerary. 2. The malicious source supplies a URL such as `javascript:alert(document.domain)`. 3. The Agent places that value in `DATA.transport.*[].links[].url` or `DATA.hotels[].links[].url`. 4. The renderer HTML-escapes the value but does not reject its scheme. 5. The generated anchor retains the dangerous URL in its `href`. 6. A user clicks the apparent booking link. 7. The browser may execute the payload in the context of the generated itinerary. ### Impact Assessment Succes ...[truncated 609 chars]- Remediation
View remediation
