Listen to this Post
The vulnerability exists within the `_encode_image_bs64` function in the `entities.py` file of AstrBot. This function is designed to read an image file from a path provided within the user’s request, encode its contents into a base64 string, and return this string in the response. The security flaw occurs because the function does not perform any validation or sanitization on the user-supplied file path before opening the file. An attacker can exploit this by crafting a malicious HTTP request that contains a path traversal payload (e.g., ../../etc/passwd) instead of a legitimate image path. The function will then read the specified file from the server’s filesystem, encode its contents, and return them within the response, leading to unauthorized disclosure of sensitive system files.
Platform: AstrBot Project
Version: v3.5.22
Vulnerability: Arbitrary File Read
Severity: Moderate
date: 2025-11-07
Prediction: 2025-11-21
What Undercode Say:
`curl -X POST http://target.com/api/endpoint -d “image_path=../../../../etc/passwd”`
`import base64; print(base64.b64decode(response_data))`
`cat entities.py | grep -A 10 “_encode_image_bs64″`
How Exploit:
Craft HTTP POST request with path traversal sequences in the `image_path` parameter to read arbitrary files from the server filesystem.
Protection from this CVE:
Implement input sanitization to block path traversal sequences. Restrict file read operations to a predefined, safe directory. Apply the principle of least privilege to the application’s service account.
Impact:
Sensitive information disclosure, including password files, application configuration, and other critical system data.
🎯Let’s Practice Exploiting & Learn Patching For Free:
Sources:
Reported By: github.com
Extra Source Hub:
Undercode

