Micro Services, Major Headaches: Detecting Vulnerabilities in Erxes' Microservices
Erxes had an authentication bypass where the gateway forwarded a user-supplied 'user' header to microservices without validation, letting any unauthenticated attacker impersonate any user including admins. A path traversal in a file-read endpoint allowed reading arbitrary files, and chained with other flaws led to remote code execution.
Published on sonarsource.com
As a developer, it can be hard to triage a reported vulnerability. How relevant is the issue?
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The gateway forwarded incoming requests without stripping a client-supplied 'user' header, and microservices trusted that header without verifying it came from the gateway; additionally, user-controlled filenames were used to build filesystem paths without proper validation.
Impact
An unauthenticated attacker could impersonate any user including admins, read arbitrary files, and by chaining with other flaws achieve remote code execution, though the RCE required specific deployment conditions and a service restart or Redis message to trigger.
What the attacker needed
Erxes instance reachable; No authentication needed for bypass; S3 storage configured for RCE chain; Ability to upload files to S3
The fix
Erxes fixed the authentication bypass by deleting the user header from incoming requests, and fixed the path traversal by removing unwanted characters from filenames; the article recommends HMAC signing for inter-service data and path normalization with directory checks.
How it was found
- Leak the Redis password from /proc/self/environ using the file read vulnerability.
- Use the authentication bypass vulnerability to configure S3 file storage with an attacker-controlled host.
- Overwrite /data/enabled-services.js with a malicious payload using the file write vulnerability.
- Configure the S3 file storage to point to the Redis host and port using the authentication bypass vulnerability.
- Trigger the Redis SSRF by uploading a crafted file containing Redis commands, causing execution of the previously written payload.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The system has several small programs (microservices) that trust a special header saying who the user is. The main gateway was supposed to set that header only after checking a login token, but it also passed through any header the visitor sent. So an attacker could simply send a header claiming to be an administrator and the services would believe it. Separately, a file-reading feature let attackers use '../' in a filename to read files outside the intended folder.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.