Open HalosGhost opened 2 years ago
It's worth pointing out that in a real-world deployment, end-users would only be able to send packets to the sentinels and watchtowers. Therefore, I think it makes sense to focus efforts hardening the external interface to those components. This particular issue applies to all components though because the socket layer does not protect against malicious packets.
Affected Branch
trunk
Basic Diagnostics
[X] I've pulled the latest changes on the affected branch and the issue is still present.
[X] The issue is reproducible in docker
Description
This issue was initially found and reported by @toddfratello, and has been confirmed using the procedure below.
To reproduce in docker, we apply the following patch to enable use of
nc
(netcat) inside the containers (this is only for ease-of-testing, the bug is present without this patch):The above will require rebuilding the docker image:
After rebuilding the docker image, the following can reliably reproduce the issue
NB: the IP address used above may be dependent on your docker configuration; but you can find the specific IP address of your coordinator in your docker setup using
docker network inspect 2pc-network
.In particular, the issue appears to be caused by this line: https://github.com/mit-dci/opencbdc-tx/blob/ef541b5ecf2c851863ec44fdcfa7f0fc0da31ba2/src/util/network/tcp_socket.cpp#L108
In the PoC above,
pkt_sz
is very large, and attempting to allocate so much space results in the Coordinator dying with the following error:Code of Conduct