CVE-2022-25303:CVE-2022-25303: Cross-site Scripting (XSS) vulnerability in whoogle-search prior to 0.7.2, exploitable via the q query parameter; input is rendered through a template using a safe filter, allowing script execution.

splash
Back

Description Preview

The package whoogle-search before version 0.7.2 is vulnerable to Cross-site Scripting (XSS) via the query string parameter q. When the value does not contain the http string, it is used to build an error_message that is rendered in the error.html template via Flask's render_template. However, the error_message is rendered using the Jinja2 safe filter, meaning the user input is not escaped, allowing an attacker to inject and execute arbitrary scripts in the victim’s browser.

Overview

This CVE details an XSS flaw in whoogle-search versions prior to 0.7.2. An attacker can craft a request with a malicious q parameter; if the parameter value lacks the http prefix, it is used to compose an error_message that is subsequently rendered in error.html. Because the error_message is passed through a safe filter, the user input is not escaped, enabling attacker-controlled script execution in the rendered page. The vulnerability is accessible over the network and requires user interaction to exploit (e.g., convincing a user to visit a crafted URL). The CVSS 3.1 metrics indicate a Network attack vector, low attack complexity, no privileges required, and a medium base score (5.4) with user interaction required and minimal impact on confidentiality and integrity.

Remediation

  • Upgrade whoogle-search to version 0.7.2 or newer (prefer the latest release) to include the fix.
  • If upgrading immediately isn’t feasible, patch the rendering path:
    • Remove or avoid using the safe filter on error_message.
    • Ensure all user-supplied input is properly escaped or sanitized before rendering (prefer automatic escaping via templates).
  • Validate and sanitize the q parameter server-side (e.g., reject or neutralize HTML/JS input, or URL-encode before processing).
  • Implement input validation rules for query parameters and enforce strict content handling in templates.
  • Add security tests and code reviews focused on template rendering and user input handling.
  • Apply additional mitigations such as Content Security Policy (CSP) headers and, if possible, a web application firewall (WAF) rule to detect and block reflected script payloads.

References

Industry ExposureMost to least
This section illustrates the prevalence of a specific Common Vulnerabilities and Exposures (CVE) across various industries based on customer reports. The ranking displays industries from the most to least affected by this particular vulnerability, offering valuable insight into where this CVE has been most frequently observed. This information can help organizations within these sectors prioritize their security efforts, understand their relative risk exposure compared to their peers, and focus remediation strategies where they are most needed. By understanding the industry-specific impact, organizations can make more informed decisions regarding patching, resource allocation, and overall risk management related to this CVE.

  1. Accommodation & Food Services: Low
    Accommodation & Food Services
  2. Administrative, Support, Waste Management & Remediation Services: Low
    Administrative, Support, Waste Management & Remediation Services
  3. Agriculture, Forestry Fishing & Hunting: Low
    Agriculture, Forestry Fishing & Hunting
  4. Arts, Entertainment & Recreation: Low
    Arts, Entertainment & Recreation
  5. Construction: Low
    Construction
  6. Educational Services: Low
    Educational Services
  7. Finance and Insurance: Low
    Finance and Insurance
  8. Health Care & Social Assistance: Low
    Health Care & Social Assistance
  9. Information: Low
    Information
  10. Management of Companies & Enterprises: Low
    Management of Companies & Enterprises
  11. Manufacturing: Low
    Manufacturing
  12. Mining: Low
    Mining
  13. Other Services (except Public Administration): Low
    Other Services (except Public Administration)
  14. Professional, Scientific, & Technical Services: Low
    Professional, Scientific, & Technical Services
  15. Public Administration: Low
    Public Administration
  16. Real Estate Rental & Leasing: Low
    Real Estate Rental & Leasing
  17. Retail Trade: Low
    Retail Trade
  18. Transportation & Warehousing: Low
    Transportation & Warehousing
  19. Utilities: Low
    Utilities
  20. Wholesale Trade: Low
    Wholesale Trade

Focus on What Matters

  1. See Everything.
  2. Identify True Risk.
  3. Proactively Mitigate Threats.

Let's talk!

background