Commit a4cb188
authored
fix(caddy): block the unauthenticated beacon validator namespace from public (VANA-BC-001) (#27)
## What
The public Caddy vhost forwards all of `/eth/*` to the beacon REST
gateway. That prefix includes Prysm's validator namespace, which is
unauthenticated by design (it is meant to be reached only by the
validator client on a trusted network). As shipped it is reachable by
anyone on the internet.
An unauthenticated remote `POST
/eth/v1/validator/prepare_beacon_proposer` writes into Prysm's
`TrackedValidatorsCache`, which is the source of `SuggestedFeeRecipient`
in the execution payload. The validator client signs the produced block
without comparing the payload's fee recipient against its configured
one. So on a node that is both publicly exposed and actively proposing,
an attacker can set the fee recipient for a validator index and redirect
that block's execution-layer priority fees to an address they control.
The proposer schedule needed for timing is published by the same
namespace (`/eth/v1/validator/duties/proposer/{epoch}`), and block
production (`/eth/v{2,3}/validator/blocks/{slot}`) is exposed too.
Reference: VANA-BC-001. Verified live against `rpc.vana.org` (the write
returns 200 and reaches the real Prysm handler; a dummy recipient was
used, nothing moved) and reproduced locally against this exact config.
## Fix
- Deny `/eth/v1|v2|v3/validator` and everything under it on the public
path with a 403, ahead of the public consensus handler.
- Move the trusted-IP handler ahead of the public handlers. It was dead
code before, because `@public_el` / `@public_cl` matched first, which
also meant `RPC_TRUSTED_IP_RANGES` had no effect. Trusted ranges now
keep full access to the execution and consensus layers, including the
validator namespace the validator client needs.
- Public reads are unchanged.
## Testing
Reproduced the deployment locally (this Caddyfile in front of a stub
beacon) and confirmed:
- public client: every `/eth/v{1,2,3}/validator/*` path, including
`prepare_beacon_proposer`, returns 403
- public client: `/eth/v1/node/syncing`, `/eth/v1/beacon/genesis` and
other reads still reach the beacon (200)
- public client: EL JSON-RPC on `/` still routes to geth
- trusted-IP client: full access preserved, including the validator
namespace
`caddy validate` passes.
## Follow-ups (not in this PR)
- Narrow the public consensus handler to an explicit read-only allowlist
(the paths are sketched in comments) instead of forwarding the whole
read namespace. Kept broad here so the security fix does not risk
breaking existing public reads.
- Set `CORS_ALLOWED_ORIGINS` explicitly and pass it to the caddy service
in `docker-compose.yml` instead of defaulting to `*`.
- `archive.vana.org:3500` reportedly exposes the REST API directly on a
public port; apply the same policy there.1 parent f48c9f3 commit a4cb188
1 file changed
Lines changed: 61 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
34 | 45 | | |
35 | 46 | | |
36 | 47 | | |
| |||
39 | 50 | | |
40 | 51 | | |
41 | 52 | | |
42 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
43 | 78 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | 79 | | |
53 | 80 | | |
54 | 81 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
59 | 107 | | |
60 | 108 | | |
61 | 109 | | |
| |||
74 | 122 | | |
75 | 123 | | |
76 | 124 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | 125 | | |
95 | 126 | | |
96 | 127 | | |
0 commit comments