CVE-2025-50736
Executive Summary
CVE-2025-50736 is an open redirect vulnerability discovered in Byaidu PDFMathTranslate version 1.9.9. The flaw resides in the /gradio_api endpoint, where the file parameter does not properly validate user-supplied URLs. An attacker can craft a malicious link that, when clicked, redirects an unsuspecting user to an arbitrary external website. This can be leveraged for phishing attacks, credential harvesting, or bypassing security filters that rely on URL whitelisting. The vulnerability has a CVSS score of 0.0 in the NVD, but based on the enriched intel, a more realistic CVSS vector is provided above. No official patch has been released at this time.
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
PDFMathTranslate is a Python-based application distributed via PyPI. The vulnerable version (1.9.9) is still available for download. Users should verify the integrity of their installed package and monitor for updates. The open redirect does not directly compromise the package supply chain, but it can be used in social engineering attacks that target users of the application.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The vulnerability is exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions are required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): Required (R) – The victim must click the crafted link.
- Scope (S): Changed (C) – The redirect can lead to a different security domain.
- Confidentiality (C): Low (L) – Limited information disclosure possible via phishing.
- Integrity (I): Low (L) – The redirect can be used to manipulate user actions.
- Availability (A): None (N) – No impact on system availability.
Threat Level: Medium. While the CVSS base score is 4.7, the real-world impact is elevated due to the ease of exploitation and potential for phishing campaigns.
Deep Dive & Mechanics
The vulnerability is a classic open redirect (CWE-601). The /gradio_api endpoint in PDFMathTranslate accepts a file parameter that specifies a URL for file processing. The application fails to validate whether the provided URL is internal or external. When a user visits a crafted URL like:
https://victim.com/gradio_api?file=https://attacker.com/phishing
The application responds with an HTTP redirect (status 302) to the attacker-controlled domain. This bypasses any client-side URL validation that might be in place, as the redirect originates from a trusted domain.
The attack flow:
- Attacker crafts a malicious link pointing to the vulnerable endpoint with an external URL in the
fileparameter. - Attacker distributes the link via email, social media, or other channels.
- Victim clicks the link, lands on the legitimate PDFMathTranslate server, and is immediately redirected to the attacker's site.
- The attacker's site can mimic a login page or other trusted interface to steal credentials.
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is presumed to be in the route handler for /gradio_api. A typical vulnerable implementation might look like:
@app.route('/gradio_api')
def gradio_api():
file_url = request.args.get('file')
return redirect(file_url)
A patched version would validate the URL against a whitelist of allowed domains or ensure the URL is not external:
from urllib.parse import urlparse
ALLOWED_DOMAINS = ['example.com', 'localhost']
@app.route('/gradio_api')
def gradio_api():
file_url = request.args.get('file')
parsed = urlparse(file_url)
if parsed.netloc not in ALLOWED_DOMAINS:
return "Invalid URL", 400
return redirect(file_url)
Exploitation & Lab Setup
Red Team
Prerequisites:
- A running instance of PDFMathTranslate v1.9.9 (e.g.,
pip install pdfmathtranslate==1.9.9) - A public-facing URL or localhost for testing
Exploit Steps:
- Identify the target PDFMathTranslate instance.
- Craft the malicious URL:
http://target.com/gradio_api?file=https://evil.com - Send the link to the victim via phishing email or other means.
- When the victim clicks, they are redirected to
https://evil.com.
Proof-of-Concept (PoC) Script:
import requests
target = "http://localhost:7860"
malicious_url = "https://attacker.com/phishing"
# Craft the redirect URL
redirect_url = f"{target}/gradio_api?file={malicious_url}"
print(f"Send this link to victim: {redirect_url}")
# Test the redirect
response = requests.get(redirect_url, allow_redirects=False)
print(f"Status: {response.status_code}")
print(f"Location header: {response.headers.get('Location')}")
Blue Team
Detection Steps:
- Monitor web server logs for requests to
/gradio_apiwith suspiciousfileparameters containing external domains. - Implement URL validation on the server side to block redirects to external sites.
- Use a web application firewall (WAF) to inspect and block requests with external redirect targets.
Lab Setup for Testing:
- Deploy PDFMathTranslate in a sandboxed environment.
- Use a tool like Burp Suite or OWASP ZAP to intercept and modify requests.
- Simulate the attack and verify that the redirect is blocked after applying mitigations.
Indicators of Compromise (IOCs)
- URL Pattern:
*/gradio_api?file=*where thefileparameter contains an external domain. - HTTP Response: 302 redirect with a
Locationheader pointing to an external site. - Log Entries: Access logs showing
GET /gradio_api?file=http://...with a 302 status code. - Network Traffic: Outbound connections from the PDFMathTranslate server to unexpected external domains.
Detection Engineering
YARA Rule
rule CVE_2025_50736_Open_Redirect {
meta:
description = "Detects open redirect attempts targeting PDFMathTranslate /gradio_api endpoint"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2025-50736"
strings:
$redirect = "/gradio_api?file="
$http = "http://"
$https = "https://"
condition:
$redirect and ($http or $https)
}
Sigma Rule
title: CVE-2025-50736 Open Redirect in PDFMathTranslate
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects HTTP requests to /gradio_api with external redirect targets
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: 'GET'
cs-uri-stem: '/gradio_api'
cs-uri-query|contains: 'file='
filter:
cs-uri-query|contains:
- 'file=http://'
- 'file=https://'
condition: selection and filter
falsepositives:
- Legitimate use of external file URLs (if any)
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2025-50736 Open Redirect in PDFMathTranslate"; flow:to_server,established; content:"GET"; http_method; content:"/gradio_api"; http_uri; content:"file="; http_uri; pcre:"/file=(https?:\/\/[^&]+)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the
/gradio_apiendpoint if not required, or restrict access via firewall rules. - Implement URL validation in the application code to only allow redirects to trusted domains (e.g., localhost or internal IPs).
- Apply a WAF rule to block requests where the
fileparameter contains an external URL.
Long-Term Fix:
- Wait for an official patch from Byaidu. Monitor the project's GitHub repository for updates.
- Upgrade to a patched version once released.
- Conduct a security audit of all endpoints to identify similar vulnerabilities.
Workaround:
- Use a reverse proxy (e.g., Nginx) to intercept and validate the
fileparameter before it reaches the application.
Valters IT