The All-Zero Key: How a 32-Byte Fallback Broke X25519 Authentication in a Linux P2P Daemon.
A Linux P2P file-sharing daemon returned 32 zero bytes as the public key for unapproved IP addresses, and because X25519 with an all-zero public key yields an all-zero shared secret, any network-adjacent host could forge authentication tickets and silently push arbitrary files into the user's home directory.
infosecwriteups.com
Published on infosecwriteups.com
Cybersecurity
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.
Context
The target is a Linux desktop client for an enterprise VPN and privacy platform that ships a background peer-to-peer file sharing daemon called fileshare-daemon. The daemon listens on the machine's virtual mesh interface, in the [redacted]/10 address space, and accepts unsolicited file transfer requests from other hosts on that mesh. Internally it is a hybrid: routing, peer discovery and IPC are written in Go, while the cryptographic primitives live in a Rust library called drop-auth.
Incoming connections are authenticated with a mutual challenge-response scheme over HTTP, then upgraded to a WebSocket for the actual transfer:
- Challenge issuance: the client makes an HTTP request and the server answers with
401 Unauthorizedand a base64 nonce in theWWW-Authenticateheader. - Ticket derivation: the client runs an X25519 Diffie-Hellman exchange between its ephemeral private key and the server's public key to obtain a shared secret.
- HMAC signing: the shared secret keys an HMAC over the nonce and a domain separation string.
- Ticket replay: the client repeats the request with the ticket in the
Authorizationheader. - Server verification: the daemon looks up the public key registered for the client's source IP, recomputes the shared secret and checks the HMAC.
The whole scheme rests on one invariant: the server must only compute shared secrets for authenticated, pre-approved peers.

Setup
The work started as a routine local audit on a Linux system. The researcher used ss to enumerate listening sockets, then built an isolated lab with Linux network namespaces and virtual Ethernet (veth) pairs so that the attack crossed a routable network boundary rather than running on loopback. The attacker namespace used [redacted] on veth0; the target namespace held the virtual mesh address [redacted] and listened on :49111/tcp. The attacker was deliberately a non-peer origin.
Finding it
A routine socket audit turned up an unfamiliar listener:
$ ss -tulpn | grep 49111tcp LISTEN 0 128 [redacted]:49111 [redacted]:* users:(("fileshare-daemon",pid=1420,fd=7))
The process fileshare-daemon was bound to the mesh interface on port 49111. That raised the architectural question the rest of the audit answers: how does a local daemon authenticate incoming, unsolicited file transfer requests from other hosts on the mesh?
[Remote Network Host] ──(TCP:49111)──> [Virtual Mesh Network Interface]
│
▼
[Linux fileshare-daemon]
├─ Go Engine (Routing & IPC)
└─ Rust Core (drop-auth crypto)
Exploitation
Step 1: Understand the authentication model
The daemon exposes an HTTP/WebSocket interface. The challenge is delivered as:
HTTP/1.1 401 Unauthorized WWW-Authenticate: drop nonce="<random_base64_nonce>"
The ticket the client must produce is:
Ticket = HMAC-SHA256(Key = SharedSecret, Data = "libdrop-auth" || Nonce)
and is replayed as:
Authorization: drop ticket="<hmac_digest>", nonce="<nonce>"
The server then fetches the public key associated with the client's source IP from its local peer registry, recomputes the shared secret and validates the digest.
Step 2: Find the fallback in the Go layer
When a connection arrives, the Rust verifier asks the Go layer for the peer's 32-byte public key through a callback. In fileshare/pubkey.go the callback does this:
func (c *PubkeyProvider) PubkeyFunc(peerIP string) []byte {
peers, err := getPeers(c.meshClient)
if err != nil {
log.Error(err)
return make([]byte, 32)
}
for _, peer := range peers {
if peer.Ip == peerIP {
pubkeyBytes, err := base64.StdEncoding.DecodeString(peer.Pubkey)
if err != nil || len(pubkeyBytes) != 32 {
log.Warnf("invalid pubkey %s: %v", peer.Pubkey, err)
return make([]byte, 32)
}
return pubkeyBytes
}
}
log.Warnf("couldn't find pubkey for ip %s", peerIP)
return make([]byte, 32)
}
getPeers() returns only authorised peers, so a request from an unknown IP fails the lookup. Instead of returning an error and aborting, the code logs a warning and returns make([]byte, 32), 32 zero bytes. The developer's assumption was that dummy zero bytes would make the handshake fail on its own.
Step 3: Follow the bytes into the Rust verifier
The Rust side (drop-auth/src/lib.rs) takes the 32-byte slice and feeds it straight into X25519:
fn create_tag(secret: &SecretKey, pubkey: &PublicKey, nonce: Nonce) -> Option<Vec<u8>> {
let shared_secret = secret.diffie_hellman(pubkey);
let mut hmac = HmacSha256::new_from_slice(shared_secret.as_bytes()).ok()?;
hmac.update(DOMAIN_STRING.as_bytes());
hmac.update(nonce.0.as_slice());
Some(hmac.finalize().into_bytes().to_vec())
}
Curve25519 itself is sound; the problem is a documented property of its Montgomery form, quoted from RFC 7748 (Section 6.1):
"The point with u = 0 has order 2… When performing X25519, inputting an all-zero coordinate results in an output of all zeros."
So the scalar multiplication collapses:
X25519(AnyPrivateKey, [0x00 * 32]) = [0x00 * 32]
Whatever private key the daemon holds, the shared secret is 32 zero bytes, and therefore so is the HMAC key:
Server-Derived Shared Secret = [0x00 * 32] Kunci Verifikasi HMAC-SHA256 = [ 0 x00 * 32 ]
The attacker can compute the same ticket offline with a constant key:
import hmac, hashlib
all_zero_key = b"\x00" * 32nonce = server_issued_noncevalid_ticket = hmac.new(all_zero_key, b"libdrop-auth" + nonce, hashlib.sha256).hexdigest()
Step 4: Handle the keep-alive requirement
Packet inspection showed the daemon caches challenge nonces per SocketAddr (IP:Port) and invalidates them on subsequent connection attempts. The unauthenticated challenge request and the authenticated follow-up therefore have to travel over a single persistent TCP keep-alive connection.
Step 5: Run the differential test
Testing used the transfer status endpoint GET /drop/v6/check/{uuid} with two source identities:
- Control (registered peer IP): the server retrieved the genuine public key, the zero-key ticket failed, and the response was
401 Unauthorized. - Test (unapproved source IP): the server defaulted to 32 zero bytes, derived the all-zero key and accepted the forged ticket, returning:
HTTP/1.1 410 GoneContent-Length: 0
410 Gone means authentication succeeded and the daemon is only reporting that the requested transfer UUID is not in its local queue.
Step 6: Upgrade to WebSocket and push a file
With a valid ticket the session was upgraded at GET /drop/v6:
GET /drop/v6 HTTP/1.1Host: [redacted]:49111Upgrade: websocketConnection: UpgradeSec-WebSocket-Key: [REDACTED]Sec-WebSocket-Version: 13Authorization: drop ticket="[ZERO_KEY_HMAC_DIGEST]", nonce="[EXTRACTED_NONCE]"
The server answered 101 Switching Protocols, and the binary transfer protocol ran to completion:
Client ──> TransferRequest: {"files":[{"path":"payload.txt","size":496}],"id":"<uuid>"}Server ──> ReqChsum: {"type":"ReqChsum","file":"pwnfile01","limit":496}Client ──> ReportChsum: {"type":"ReportChsum", ...} (SHA-256 digest)Server ──> Start: {"type":"Start","file":"pwnfile01","offset":0}Client ──> [Binary Chunk Frame: u32le length + file id + raw payload]Server ──> Done: {"type":"Done","file":"pwnfile01","bytes_transfered":496}
The file landed in the victim's download directory. The write was confirmed across three independent runs with matching hashes (sha256: [redacted]).
Step 7: Note why nothing was shown to the user
Normally an incoming transfer triggers a desktop prompt. During the exploit the daemon's logs showed:
event_manager.go:199: failed to retrieve peer requesting transfer: peer [redacted] not found
Because the sender IP was not in the peer table, the event manager returned early and no notification or confirmation prompt appeared. The file was delivered silently.
Root cause
The bug is a fail-open error path across a language boundary. The Go callback cannot distinguish "peer not found" from "here is a key", because its return type is a bare []byte; on every failure branch it synthesises 32 zero bytes. The Rust verifier trusts that slice as a public key and performs X25519 without rejecting low-order or all-zero coordinates, which RFC 7748 explicitly recommends treating as invalid. The two mistakes compound: the fallback supplies exactly the one input for which the curve's output is independent of the private key, and the crypto layer has no check to catch it. The strong curve and HMAC-SHA256 over a domain-separated nonce did not prevent the bypass because the key material was attacker-known.
Impact
The researcher assessed the issue as Priority 1 / High, CVSS v4.0: 7.1. An attacker who can reach the daemon's listening interface on the mesh can:
- write arbitrary files, controlling the file name, transfer UUID and binary contents;
- direct target paths into sensitive locations when transfers are accepted, such as
~/.config/autostart/for persistence across logins; - deliver the file silently, because the event manager's early return suppresses every desktop alert.
Limits stated in the report: existing files are not overwritten, since the daemon appends collision suffixes such as file(1).txt, and network reachability to the daemon's listening interface is required.
Fix
The report sets out three defensive principles.
Fail closed across language boundaries. Never synthesise dummy cryptographic material on error paths; propagate an explicit error to the Rust verifier and terminate the connection:
func (c *PubkeyProvider) PubkeyFunc(peerIP string) ([]byte, error) {
peers, err := getPeers(c.meshClient)
if err != nil {
return nil, fmt.Errorf("failed to retrieve peers: %w", err)
}
for _, peer := range peers {
if peer.Ip == peerIP {
return base64.StdEncoding.DecodeString(peer.Pubkey)
}
}
return nil, fmt.Errorf("access denied: unapproved peer IP %s", peerIP)
}
Validate against low-order points. Reject public keys with low order or non-canonical coordinates before scalar multiplication, and treat any exchange that produces all-zero coordinates as invalid, as RFC 7748 recommends.
Decouple alerting from identity lookups. A security alert must not depend on an optional metadata query succeeding. An unsolicited connection that starts a file transfer should raise an alert whether or not the peer is recognised.
Variants to test
- Other FFI key lookups. Look for Go-to-Rust (or any managed-to-native) callbacks that return key material as a fixed-size byte slice. A positive result is a failure branch that returns zeros, a fixed pattern, or an uninitialised buffer instead of an error, and a handshake that completes for an unknown peer.
- Low-order point acceptance. Send X25519 public keys of small order (all-zero and the other low-order points) to any handshake endpoint. A positive result is a shared secret that does not depend on the server's private key, visible as a ticket that verifies with a constant key.
- Nonce reuse across connections. Replay a challenge nonce on a second TCP connection to the same
IP:Port. If the nonce is still accepted, the per-SocketAddrcache described here is absent or weaker elsewhere, and the keep-alive constraint disappears. - Silent transfer paths. Trigger a transfer from an IP absent from the peer table and watch for a desktop prompt. A positive result is a completed transfer with no user-visible notification, which points at an early return in the event manager.
- Collision suffix behaviour. Send a file whose name already exists in the target directory. A positive result is a new file with a suffix such as
file(1).txtrather than an overwrite, which bounds the impact but also confirms the write path. - Status endpoint as an oracle. Use a transfer status endpoint with a forged ticket from an unapproved source. A positive result is a response other than
401, such as410 Gone, which shows authentication passed before the resource lookup failed.
What happened, in plain words
Imagine a shared office building where every tenant has a private mailbox. The building has a receptionist who is supposed to check your ID before letting you drop a parcel into anyone's mailbox. One day the receptionist is handed a list of tenants, but the list is missing your name. Instead of saying "I cannot verify you, please leave", the receptionist hands you a blank ID card with nothing written on it. The security guard at the mailroom looks at the blank card, and because of a quirk in how the card reader works, a blank card is treated as a valid master key. You walk in and drop a parcel into any mailbox you like, and nobody is told.
That is, in essence, what this report describes. A Linux desktop program for a VPN and privacy product runs a background helper, called a daemon, that lets people on the same private network send files to each other. The helper is supposed to check who is sending a file before accepting it. When it could not find the sender in its list of known peers, it did not refuse. It handed the cryptography code a key made of 32 zero bytes. Because of a documented mathematical property of the curve used for the key exchange, a key of all zeros produces a shared secret of all zeros, no matter what secret the server holds. The attacker could therefore work out the correct authentication ticket offline, using a key everyone knows, and push a file onto the victim's disk without any prompt appearing.
The researcher rated it Priority 1 / High, CVSS v4.0: 7.1. The rest of this article walks through the same steps as the technical write-up, but explains every term from scratch.

Background: what the pieces are
Before the steps, a few words that will come up constantly.
- A daemon is a program that runs in the background, with no window of its own, waiting to do a job. Your computer has many: one for sound, one for printing, and so on. This report is about one called
fileshare-daemon. - A peer-to-peer (P2P) system lets two computers talk directly to each other, without a central server in the middle. Think of two people passing notes directly rather than through a post office.
- A virtual mesh network is a private network built on top of the ordinary internet. Each machine gets an address as if they were all plugged into the same switch, even if they are in different cities. The addresses in this report live in the
[redacted]/10range, which is a block of addresses reserved for this kind of use. - Go and Rust are two programming languages. This daemon is written in both: Go handles the networking and the list of peers, Rust handles the cryptography. When two languages share a program, they talk through an interface, and mistakes often happen exactly at that seam.
- Cryptography is the mathematics of keeping secrets. Here it is used for two jobs: agreeing on a shared secret (the key exchange) and proving you know that secret (the ticket).
- An API (application programming interface) is the set of requests one piece of software accepts from another. When you use a website and your browser asks the server for your messages, it is calling an API. The daemon in this report exposes an API over HTTP, the same protocol your browser uses.
- A token or ticket is a short piece of data that proves you are allowed to do something, a bit like a cloakroom ticket: whoever holds it can collect the coat. In this system the ticket is a cryptographic signature, not a random string.
- A nonce is a number used once. The server hands out a fresh one for each challenge so that an old answer cannot be replayed later.
- HMAC (hash-based message authentication code) is a way of signing a message with a secret key. Anyone with the key can produce the same signature; anyone without it cannot. It is like a wax seal that only the key holder can make.
- SHA-256 is a hash function: it turns any data into a fixed-length fingerprint. The same input always gives the same fingerprint, and it is practically impossible to work backwards from the fingerprint to the input.
- X25519 and Curve25519 are the names of the key-exchange mathematics used here. Two parties each have a private key (kept secret) and a public key (shared openly). Combining your private key with the other side's public key gives a shared secret that both sides can compute but an eavesdropper cannot. It is like two people each mixing their own secret paint into a public sample: both end up with the same final colour, but a watcher cannot reproduce it.
- RFC 7748 is the public document that defines how X25519 should behave. It is the rulebook, and it contains a warning that matters later.
- A WebSocket is a connection that stays open in both directions, unlike a normal web request that ends after one answer. It is used here because a file transfer needs a long conversation.
- Fail-open and fail-closed describe what a system does when something goes wrong. Fail-closed means it refuses and stops, like a bank vault door that stays locked when the power fails. Fail-open means it lets you through, like a barrier that lifts when it cannot read your card. This report is about a fail-open mistake.
- CVSS is a standard scoring system for the severity of a security flaw. A score of 7.1 is in the high range.
The setup
The work began as a routine local audit on a Linux machine. The goal was to find out what the machine was running and whether anything was exposed. To test safely, the researcher built an isolated lab using Linux network namespaces (a way of giving one machine several separate network stacks, so traffic between them looks like traffic between real computers) and veth pairs (virtual cables connecting two of those namespaces). The attacker side used [redacted] on veth0; the target side held the mesh address [redacted] and listened on port 49111. The attacker was deliberately not a known peer, because the whole question is what happens to strangers.
Finding it
The first step was simply to list what was listening on the machine. The tool ss shows open network sockets, and -tulpn asks for TCP and UDP sockets, listening ones, with the process name and port number.
$ ss -tulpn | grep 49111tcp LISTEN 0 128 [redacted]:49111 [redacted]:* users:(("fileshare-daemon",pid=1420,fd=7))
Line by line: ss -tulpn lists sockets; grep 49111 keeps only the line mentioning port 49111. The output says a process called fileshare-daemon (process ID 1420) is listening on [redacted]:49111, which is the machine's address on the virtual mesh. In plain terms: a background program is waiting for connections from the private network on that port.
That raised the question the rest of the audit answers: how does this daemon decide whether an incoming, unsolicited file transfer is allowed?
[Remote Network Host] ──(TCP:49111)──> [Virtual Mesh Network Interface]
│
▼
[Linux fileshare-daemon]
├─ Go Engine (Routing & IPC)
└─ Rust Core (drop-auth crypto)
This diagram shows the path: a remote host connects over TCP to port 49111, the traffic arrives on the virtual mesh interface, and the daemon handles it with two parts, a Go engine for routing and inter-process communication (IPC, the way programs talk to each other on one machine) and a Rust core called drop-auth for the cryptography.
Step 1: Understand the authentication model
The daemon speaks HTTP, the language of the web, and upgrades to a WebSocket for the transfer itself. Before any file moves, the sender must prove who they are with a challenge-response exchange. A challenge-response is like a bouncer asking a question only a member can answer: the server sends a random value, and the client must sign it with a secret.
The challenge arrives as an HTTP response:
HTTP/1.1 401 Unauthorized WWW-Authenticate: drop nonce="<random_base64_nonce>"
401 Unauthorized is the standard HTTP status for "you have not identified yourself". The WWW-Authenticate header is where a server says what kind of credentials it wants. Here it asks for a scheme called drop and supplies a nonce, a random value encoded in base64 (a way of writing binary data as plain text).
The client must then produce a ticket:
Ticket = HMAC-SHA256(Key = SharedSecret, Data = "libdrop-auth" || Nonce)
This says: take the shared secret as the HMAC key, sign the text libdrop-auth followed by the nonce (the || means "followed by"), and the result is the ticket. The fixed string libdrop-auth is a domain separation string: it makes sure a signature made for this purpose cannot be reused for a different purpose, the way a form stamped "for internal use only" cannot be used as a passport.
The ticket is sent back in a header:
Authorization: drop ticket="<hmac_digest>", nonce="<nonce>"
Authorization is the standard header for credentials. The server then looks up the public key registered for the client's source IP address, recomputes the shared secret, and checks the signature. If it matches, the client is who it claims to be.
The whole scheme rests on one rule: the server must only compute shared secrets for peers it has already approved. If it ever computes one for a stranger, the stranger can sign tickets too.
Step 2: Find the fallback in the Go layer
When a connection arrives, the Rust verifier needs the peer's 32-byte public key. It asks the Go layer through a callback, which is simply a function one part of a program hands to another so it can be called later. The file fileshare/pubkey.go contains that callback:
func (c *PubkeyProvider) PubkeyFunc(peerIP string) []byte {
peers, err := getPeers(c.meshClient)
if err != nil {
log.Error(err)
return make([]byte, 32)
}
for _, peer := range peers {
if peer.Ip == peerIP {
pubkeyBytes, err := base64.StdEncoding.DecodeString(peer.Pubkey)
if err != nil || len(pubkeyBytes) != 32 {
log.Warnf("invalid pubkey %s: %v", peer.Pubkey, err)
return make([]byte, 32)
}
return pubkeyBytes
}
}
log.Warnf("couldn't find pubkey for ip %s", peerIP)
return make([]byte, 32)
}
Line by line. The function is named PubkeyFunc, takes a peer's IP address as text, and returns a slice of bytes (a byte slice is just an array of raw bytes, the way a computer stores binary data). It first calls getPeers, which fetches the list of known peers. If that call fails, it logs the error and returns make([]byte, 32), which creates 32 bytes all set to zero. Then it loops over the peers; if one matches the IP, it decodes that peer's stored public key from base64 and returns it, unless the decoding fails or the result is not 32 bytes long, in which case it logs a warning and again returns 32 zero bytes. If the loop finishes without a match, it logs couldn't find pubkey for ip and returns 32 zero bytes once more.
The important part is the last line. getPeers() only returns authorised peers, so a request from an unknown IP never matches. Instead of returning an error and stopping, the code logs a warning and hands back a key made of zeros. The developer clearly assumed that dummy zeros would make the handshake fail on its own. That assumption is the bug.
Step 3: Follow the bytes into the Rust verifier
The Rust side, in drop-auth/src/lib.rs, takes those 32 bytes and feeds them straight into the X25519 routine:
fn create_tag(secret: &SecretKey, pubkey: &PublicKey, nonce: Nonce) -> Option<Vec<u8>> {
let shared_secret = secret.diffie_hellman(pubkey);
let mut hmac = HmacSha256::new_from_slice(shared_secret.as_bytes()).ok()?;
hmac.update(DOMAIN_STRING.as_bytes());
hmac.update(nonce.0.as_slice());
Some(hmac.finalize().into_bytes().to_vec())
}
In words: create_tag takes the server's secret key, the peer's public key and the nonce, and returns an optional byte vector (the Option means it may return nothing if something fails). It computes the shared secret with diffie_hellman, starts an HMAC-SHA256 using that shared secret as the key, feeds in the domain string and the nonce, and returns the finished signature. There is no check on the public key before it is used. That missing check is the second half of the problem.
Curve25519 itself is not broken. The issue is a documented property of how it is implemented, quoted from RFC 7748, Section 6.1:
"The point with u = 0 has order 2… When performing X25519, inputting an all-zero coordinate results in an output of all zeros."
In everyday terms: the curve has a special point, the zero point, and multiplying any secret by it gives zero. It is like a multiplication table where any number times zero is zero. So the calculation collapses:
X25519(AnyPrivateKey, [0x00 * 32]) = [0x00 * 32]
0x00 is how programmers write the byte value zero, and [0x00 * 32] means 32 of them. Whatever private key the daemon holds, the shared secret comes out as 32 zero bytes, and therefore so does the HMAC key:
Server-Derived Shared Secret = [0x00 * 32] Kunci Verifikasi HMAC-SHA256 = [ 0 x00 * 32 ]
(Kunci Verifikasi is Indonesian for "verification key".) The attacker can now compute the same ticket offline, with a key that is publicly known:
import hmac, hashlib
This line imports two Python modules: hmac for the signing function and hashlib for SHA-256.
all_zero_key = b"\x00" * 32nonce = server_issued_noncevalid_ticket = hmac.new(all_zero_key, b"libdrop-auth" + nonce, hashlib.sha256).hexdigest()
This builds the key as 32 zero bytes (b"\x00" * 32), takes the nonce the server issued, and computes the HMAC over libdrop-auth followed by the nonce, exactly as the server will. The result is a valid ticket, produced without ever knowing the server's secret.
Step 4: Handle the keep-alive requirement
Before running the attack, the researcher inspected the traffic and found that the daemon caches challenge nonces per SocketAddr, meaning per IP address and port pair, and throws them away when a new connection is attempted. A SocketAddr is simply the combination of an IP address and a port that identifies one end of a connection. The practical consequence: the request that asks for the challenge and the request that presents the ticket must travel over one single persistent TCP connection, a keep-alive connection, rather than two separate ones. Otherwise the nonce is no longer valid when the second request arrives.
Step 5: Run the differential test
The test used the transfer status endpoint GET /drop/v6/check/{uuid}, where {uuid} is a unique identifier for a transfer. An endpoint is one specific address on a server that accepts a particular kind of request. The researcher compared two source identities, which is a differential test: change one thing and see whether the result changes.
- Control (registered peer IP): the server found the genuine public key, the zero-key ticket did not match, and the answer was
401 Unauthorized. This is the expected behaviour and proves the test is meaningful. - Test (unapproved source IP): the server fell back to 32 zero bytes, derived the all-zero key, and accepted the forged ticket, answering:
HTTP/1.1 410 GoneContent-Length: 0
410 Gone is an HTTP status meaning the requested resource no longer exists. Content-Length: 0 says the body is empty. The key point is that it is not 401: authentication passed, and the daemon is merely saying it has no transfer with that identifier in its queue. The status code itself became the proof.
Step 6: Upgrade to WebSocket and push a file
With a valid ticket, the session was upgraded to a WebSocket at GET /drop/v6:
GET /drop/v6 HTTP/1.1Host: [redacted]:49111Upgrade: websocketConnection: UpgradeSec-WebSocket-Key: [REDACTED]Sec-WebSocket-Version: 13Authorization: drop ticket="[ZERO_KEY_HMAC_DIGEST]", nonce="[EXTRACTED_NONCE]"
Reading it: GET /drop/v6 is the request for the transfer endpoint. Host names the server and port. Upgrade: websocket and Connection: Upgrade ask the server to switch protocols from plain HTTP to a WebSocket. Sec-WebSocket-Key is a value the client sends as part of the handshake (redacted here). Sec-WebSocket-Version: 13 states the WebSocket protocol version. The Authorization header carries the forged ticket and the nonce it was signed with.
The server answered 101 Switching Protocols, which is the standard reply that the upgrade succeeded. Then the binary transfer protocol ran to completion:
Client ──> TransferRequest: {"files":[{"path":"payload.txt","size":496}],"id":"<uuid>"}Server ──> ReqChsum: {"type":"ReqChsum","file":"pwnfile01","limit":496}Client ──> ReportChsum: {"type":"ReportChsum", ...} (SHA-256 digest)Server ──> Start: {"type":"Start","file":"pwnfile01","offset":0}Client ──> [Binary Chunk Frame: u32le length + file id + raw payload]Server ──> Done: {"type":"Done","file":"pwnfile01","bytes_transfered":496}
Step by step: the client sends a TransferRequest describing a file called payload.txt of 496 bytes and a transfer ID. The server replies with ReqChsum, asking for a checksum of the file. The client sends ReportChsum with a SHA-256 digest, so the server can verify the file arrived intact. The server sends Start with an offset of 0, meaning "begin at the first byte". The client sends the file data in a binary frame, whose format is a 4-byte little-endian length, then the file ID, then the raw bytes (u32le means an unsigned 32-bit integer stored least significant byte first). Finally the server sends Done confirming 496 bytes were transferred.
The file landed in the victim's download directory. The write was confirmed across three independent runs, each producing the same hash: sha256: [redacted]. A matching hash across runs means the same bytes were written every time.
Step 7: Note why nothing was shown to the user
Normally, receiving a file triggers a desktop prompt asking the user to accept. During the exploit, the daemon's log showed:
event_manager.go:199: failed to retrieve peer requesting transfer: peer [redacted] not found
This line says the event manager, the part that raises notifications, tried to look up the sender's IP in the peer table and did not find it. Because of that, it returned early and never displayed a notification or confirmation prompt. The file was delivered silently. This is a second, independent consequence of the same design: the alerting depended on a lookup that was guaranteed to fail for a stranger.
Root cause
The bug is a fail-open error path across a language boundary. The Go callback cannot tell "peer not found" apart from "here is a key", because its return type is a bare byte slice with no room for an error. On every failure branch it makes up 32 zero bytes. The Rust verifier trusts that slice as a public key and runs X25519 without rejecting low-order or all-zero coordinates, which RFC 7748 explicitly recommends treating as invalid. The two mistakes compound: the fallback supplies exactly the one input for which the curve's output does not depend on the private key, and the crypto layer has no check to catch it. The strong curve and the HMAC over a domain-separated nonce did not stop the bypass, because the key material was known to the attacker.
Impact
The researcher assessed the issue as Priority 1 / High, CVSS v4.0: 7.1. An attacker who can reach the daemon's listening interface on the mesh can:
- write arbitrary files, controlling the file name, transfer ID and binary contents;
- direct target paths into sensitive locations when transfers are accepted, such as
~/.config/autostart/, a folder whose contents run automatically when the user logs in, which would give persistence across sessions; - deliver the file silently, because the event manager's early return suppresses every desktop alert.
The report also states the limits: existing files are not overwritten, since the daemon appends collision suffixes such as file(1).txt, and the attacker needs network reachability to the daemon's listening interface.
Fix
The report sets out three defensive principles.
Fail closed across language boundaries. Never make up dummy cryptographic material on error paths. Pass an explicit error to the Rust verifier and terminate the connection:
func (c *PubkeyProvider) PubkeyFunc(peerIP string) ([]byte, error) {
peers, err := getPeers(c.meshClient)
if err != nil {
return nil, fmt.Errorf("failed to retrieve peers: %w", err)
}
for _, peer := range peers {
if peer.Ip == peerIP {
return base64.StdEncoding.DecodeString(peer.Pubkey)
}
}
return nil, fmt.Errorf("access denied: unapproved peer IP %s", peerIP)
}
The change is in the return type: ([]byte, error) means the function can return either a key or an error, and the caller must handle both. Every failure branch now returns an error instead of zeros, so an unknown peer is refused rather than given a blank key.
Validate against low-order points. Reject public keys with low order or non-canonical coordinates before the multiplication, and treat any exchange that produces all-zero coordinates as invalid, as RFC 7748 recommends. In everyday terms: check the ID card is not blank before trusting it.
Decouple alerting from identity lookups. A security alert must not depend on an optional metadata query succeeding. An unsolicited connection that starts a file transfer should raise an alert whether or not the peer is recognised.
Variants to test
- Other FFI key lookups. Look for Go-to-Rust, or any managed-to-native, callbacks that return key material as a fixed-size byte slice. A positive result is a failure branch that returns zeros, a fixed pattern or an uninitialised buffer instead of an error, and a handshake that completes for an unknown peer. FFI means foreign function interface, the mechanism by which one language calls code written in another.
- Low-order point acceptance. Send X25519 public keys of small order, including the all-zero one and the other low-order points, to any handshake endpoint. A positive result is a shared secret that does not depend on the server's private key, visible as a ticket that verifies with a constant key.
- Nonce reuse across connections. Replay a challenge nonce on a second TCP connection to the same IP and port. If the nonce is still accepted, the per-address cache described here is absent or weaker elsewhere, and the keep-alive constraint disappears.
- Silent transfer paths. Trigger a transfer from an IP absent from the peer table and watch for a desktop prompt. A positive result is a completed transfer with no user-visible notification, which points at an early return in the event manager.
- Collision suffix behaviour. Send a file whose name already exists in the target directory. A positive result is a new file with a suffix such as
file(1).txtrather than an overwrite, which bounds the impact but also confirms the write path. - Status endpoint as an oracle. Use a transfer status endpoint with a forged ticket from an unapproved source. A positive result is a response other than
401, such as410 Gone, which shows authentication passed before the resource lookup failed. An oracle here means a response that leaks information about internal state.
Conclusion
Cryptographic protocols rarely fail because the mathematics is flawed. They fail at the boundaries: where high-level application logic meets a cryptographic library, handles errors and enforces access control. By replacing an error with an array of zeros, a strong mutual authentication design was reduced to a trivial bypass. Careful code review, tests for unexpected failure states, and a strict deny-by-default design remain the most effective defences.
Glossary
- API: the set of requests one piece of software accepts from another.
- Base64: a way of writing binary data using only plain text characters.
- Callback: a function passed to another part of a program so it can be called later.
- Challenge-response: an authentication method where the server sends a random value and the client must sign it with a secret.
- Control group: in a test, the case with known expected behaviour, used to prove the test is meaningful.
- CVSS: a standard scoring system for the severity of a security flaw.
- Daemon: a program that runs in the background with no window of its own.
- Differential test: a test that changes one thing and compares the result against a control.
- Domain separation string: a fixed label mixed into a signature so it cannot be reused for a different purpose.
- Endpoint: one specific address on a server that accepts a particular kind of request.
- Fail-closed: refusing and stopping when something goes wrong.
- Fail-open: letting a request through when something goes wrong.
- FFI (foreign function interface): the mechanism by which one programming language calls code written in another.
- Hash function: a function that turns data into a fixed-length fingerprint that cannot practically be reversed.
- HMAC: a way of signing a message with a secret key so that only key holders can produce the signature.
- HTTP: the protocol browsers and servers use to exchange requests and responses.
- IPC (inter-process communication): the way programs on one machine talk to each other.
- Keep-alive connection: a single network connection kept open for several requests.
- Low-order point: a point on a curve with special mathematical properties, including the all-zero point, that can make a key exchange predictable.
- Network namespace: a way of giving one machine several separate network stacks.
- Nonce: a number used once, sent by the server so old answers cannot be replayed.
- Oracle: a response that leaks information about internal state.
- Peer-to-peer (P2P): a system where computers talk directly to each other without a central server.
- Persistence: a way for an attacker to keep access across reboots or logins.
- Public key / private key: a pair where the public key is shared openly and the private key is kept secret.
- RFC 7748: the public document that defines how X25519 should behave.
- SHA-256: a hash function producing a 256-bit fingerprint.
- SocketAddr: the combination of an IP address and a port that identifies one end of a connection.
- ss: a Linux command that lists open network sockets.
- TCP: the reliable, connection-based protocol that carries most internet traffic.
- Ticket: a piece of data proving you are allowed to do something.
- Token: a short piece of data used to prove identity or permission.
- UUID: a unique identifier for a record or transfer.
- veth pair: a virtual cable connecting two network namespaces.
- Virtual mesh network: a private network built on top of the internet, giving each machine an address as if they shared a switch.
- WebSocket: a connection that stays open in both directions for a long conversation.
- X25519 / Curve25519: the key-exchange mathematics used to agree on a shared secret.