{"id":"XE-0108","kind":"bounty","visibility":"public","source":"github","source_repo":"xeprotocol/xe","source_ref":"178","source_url":"https://github.com/xeprotocol/xe/issues/178","reporter_id":37,"title":"Grafana on the XE node host allows anonymous datasource writes and SSRF to link-local metadata (Medium)","area":"ops-testnet","claimed_tier":null,"assessed_tier":null,"verdict":null,"duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":null,"status":"triaging","closed_reason":null,"github_state":"open","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-10-29T13:57:28.198902+00:00","updated_at":"2026-11-10T00:11:48.295281+00:00","source_created_at":"2026-10-29T08:31:07+00:00","told_at":"2026-11-08T20:18:58+00:00","status_changed_at":"2026-11-08T20:17:48.105256+00:00","url":"https://bounty.xe.network/XE-0108","body":"# Grafana on the XE node host allows anonymous datasource writes and SSRF to link-local metadata\n\n## Summary\n\nGrafana 13.0.0 runs on the XE node host at `45.77.226.208:3000` with anonymous access\nenabled. Without any credentials an attacker can read the full datasource list, which\nexposes 22 internal PostgreSQL endpoints, a Docker socket and four cloud metadata\nservices, and can create and delete datasources. The datasource proxy also performs\nserver-side requests on the attacker's behalf: I retrieved the live AWS metadata\nlisting through it from a host that cannot reach `169.254.169.254` directly.\n\n## Details\n\n- Type: missing authentication for a critical function (CWE-306), SSRF (CWE-918)\n- Asset: `45.77.226.208:3000`. This host serves `ldn.core.test.network` and\n  `faucet.test.network`, confirmed by DNS this session.\n- Endpoint: `/api/datasources`, `/api/datasources/proxy/uid/{uid}/`\n- Auth required: none\n- Severity claimed: Medium. The programme's Medium tier covers \"Information\n  disclosure: metadata leak\". I first drafted this as High and downgraded it, because\n  the escalation paths I expected did not hold. Details in the limits section.\n\n## Root cause\n\nThe monitoring stack ships in the repository at `deploy/monitoring/compose.yml`:\n\n```yaml\ngrafana:\n  image: grafana/grafana:11.5.1\n  ports: [\"3000:3000\"]\n  environment:\n    GF_SECURITY_ADMIN_PASSWORD: ${GF_ADMIN_PASSWORD:-changeme}\n    GF_USERS_ALLOW_SIGN_UP: \"false\"\n```\n\nThe port is published on every interface with no loopback bind, and\n`GF_AUTH_ANONYMOUS_ENABLED` is never set. Sign-up is disabled but anonymous access is\nnot, which is the gap. The live instance also runs 13.0.0 while the repository pins\n11.5.1, so the running configuration has drifted from the audited one.\n\n## Steps to reproduce\n\nEnvironment: 29 October 2026, no credentials, no session, no account on the testnet.\n\n1. Read the datasource list:\n\n```http\nGET /api/datasources HTTP/1.1\nHost: 45.77.226.208:3000\n```\n\nResponse: `200` with 112 datasources.\n\n2. Confirm write access with a non-destructive probe. An invalid body is rejected by\npayload validation, which proves the request cleared authentication:\n\n```http\nPOST /api/datasources HTTP/1.1\nHost: 45.77.226.208:3000\nContent-Type: application/json\n\n{\"__probe\":\"invalid\"}\n```\n\nResponse: `400 {\"message\":\"bad request data\"}`\n\nA `401` or `403` would mean authentication blocked the request. A `400` means it did\nnot. The same holds for `DELETE /api/datasources/uid/{id}`, which returns `404\n{\"message\":\"Data source not found\"}` for a uid that does not exist.\n\n3. Control, to show that gating works where it is configured:\n\n```http\nGET /api/admin/settings HTTP/1.1\nHost: 45.77.226.208:3000\n```\n\nResponse: `403`. So the anonymous role is not simply a full admin role; it is an\nanonymous role that was never restricted.\n\n4. Use the datasource proxy to reach link-local metadata. The datasource with uid\n`afujg1jeqtxc0e` has URL `http://169.254.169.254/latest/meta-data/`:\n\n```http\nGET /api/datasources/proxy/uid/afujg1jeqtxc0e/ HTTP/1.1\nHost: 45.77.226.208:3000\n```\n\nResponse: `200`, header `Via: 1.1 grafana`, body:\n\n```\ninstance-id\ninstance-v2-id\nmac\nlocal-ipv4\npublic-ipv4\nnetwork_config/content_path\nhostname\nSUBID\nipv6-addr\nipv6-prefix\n```\n\n5. Control for the SSRF claim. From an unrelated host, the same address is not\nreachable:\n\n```http\nGET http://169.254.169.254/latest/meta-data/\n```\n\nResponse: `404 No such metadata item`\n\nThe proxy returns `200` with data where a direct request returns `404`, so Grafana is\ngenuinely making the server-side request.\n\n## Impact\n\nShown:\n\n- 112 datasources readable without credentials, including 22 internal PostgreSQL\n  endpoints (`172.17.0.6:5432`, `172.18.0.2:5432`, `172.19.0.6:5432` and others) with\n  usernames `postgres` and `admin`, the Docker socket at `http://127.0.0.1:2375`, and\n  Prometheus at `http://localhost:9091`.\n- Datasources can be created and deleted without credentials. Deleting them removes\n  the team's visibility, and adding one is a persistence vector.\n- Server-side requests to link-local addresses on the attacker's behalf, demonstrated\n  against `169.254.169.254`.\n- The proxy attempts connections to internal hosts that are unreachable from the\n  internet: `172.17.0.6:5432` returns \"No route to host\" from outside, while the\n  Grafana proxy reaches far enough to get a `502` back.\n\nNot shown, stated plainly:\n\n- No database credentials were exposed. 101 datasources carry a readable `user` field,\n  but every `password` field is empty.\n- No cloud credentials were retrieved. Every metadata sub-path I tried returned `200`\n  with an empty body, and a callback to a listener I controlled returned `502`, so\n  arbitrary egress appears blocked.\n- No path traversal out of the datasource proxy succeeded (`404`).\n- No funds, keys or ledger state were affected.\n\nBecause the escalation to credentials did not hold, I am claiming Medium rather than\nHigh. The demonstrated impact is disclosure of internal topology plus unauthenticated\nwrite access to the monitoring stack.\n\n## Remediation\n\n- Set `GF_AUTH_ANONYMOUS_ENABLED=false`, or restrict the anonymous role to a viewer\n  with no datasource write permission.\n- Bind the port to loopback (`127.0.0.1:3000:3000`) and reach Grafana over the tunnel\n  or VPN, the way the node API does.\n- Remove the metadata-service datasources. They serve no monitoring purpose and turn\n  Grafana into an SSRF pivot.\n- Rotate any credential that was ever embedded in a datasource, since the list was\n  world-readable.\n- Pin the image version and reconcile the 11.5.1 to 13.0.0 drift.\n\n## Notes\n\n- I created and deleted nothing during verification. The write probes used an invalid\n  body and a non-existent uid, and the datasource count stayed at 112 throughout.\n- The 112 datasources are not mine. Their names are the fingerprints of automated SSRF\n  scanners that reached this instance earlier: `_phx_*`, `_probe_*`, `scan_*`,\n  `gf_ssrf_docker`, `gf_inf_docker`, and one entry named `t` pointing at `http://x`.\n  I am flagging them so triage can separate them from this report.\n- The PoC is a single script that prints a pass or fail per step. It ran three\n  consecutive times with 8 of 8 checks passing and exit code 0.\n","patch_refs":[{"id":178,"repo":"xeprotocol/xe","kind":"pr","ref":"181","title":"fix(deploy): disable anonymous access in Grafana and restrict ports to loopback (fixes #178)","url":"https://github.com/xeprotocol/xe/pull/181","note":"","state":"open","author":"arturbarszcz78","added_by":"desk","created_at":"2026-10-29T13:57:30.091343+00:00"}],"thread":[{"id":1167,"source":"github","source_ref":"6726597599","author":"Joseph Denne","team":true,"body":"Thank you for the report. We have reproduced the exposure you describe on the monitoring host and are correcting the deployment; the ticket is being handled and we will update you here when it is resolved.","created_at":"2026-11-08T20:18:58+00:00"}]}