P2P File Transfer

Is Peer-to-Peer File Transfer Secure?

By SRIFT maintainers · Published

Reviewed by SRIFT maintainers · last reviewed against the SRIFT 4.3.2 source · third-party facts checked 8 October 2026.

Short answer

Peer-to-peer file transfer can be secure, but “direct” and “secure” are different properties. A direct WebRTC connection is always encrypted in transit and leaves no stored copy on a server. It does not, by itself, prove who is on the other end, it shows each peer the other's IP address, and it does nothing to check whether the file you receive is safe to open.

Whether a particular tool is secure depends on four answers: how keys are verified, what happens on the relay fallback, what the servers can observe, and who is allowed to join. The checklist at the end applies to any P2P tool, with SRIFT's own answers alongside.

Encrypted in transit?
Yes on WebRTC: DTLS is mandatory
Stored copy on a server?
None on the direct path
Who learns your IP?
The other peer, plus any TURN or relay used
Weakest point
Key introduction through the signaling server

Key takeaways

  • A direct WebRTC connection is always encrypted in transit (DTLS) and leaves no copy on a server, but “direct” does not prove who is on the other end.
  • Each peer learns the other's IP address. A TURN relay hides it from the peer, but the relay then sees both addresses.
  • The weak point of most browser tools is key introduction: fingerprints travel through the signaling server, so an actively malicious operator could interpose unless keys can be verified.
  • Encryption says nothing about whether a received file is safe to open.
  • Before trusting any tool, ask how keys are verified, what the relay fallback protects, what the servers observe, and who may join.

A threat model for P2P transfer in general, with SRIFT's answers as one example. The complete SRIFT design is in the SRIFT security architecture.

What a direct connection protects

The strongest property of a live transfer is what it does not create: a copy of the file sitting in someone else's storage. There is no bucket to misconfigure, no retention policy to read, no provider staff or subpoena with access to the bytes later, and nothing left behind when the recipient forgets to delete a link. For many leaks the stored copy is the whole story, so removing it removes a real class of risk.

The second property comes from WebRTC itself. The WebRTC security architecture (RFC 8827) requires data channels to run over DTLS, so there is no unencrypted mode a careless developer can switch on. Someone on the same café Wi-Fi, the ISP, or a router along the way sees encrypted UDP packets, their sizes and their timing. DTLS also authenticates every record, so a record altered in flight is rejected instead of being delivered.

Those two properties are real, and they are also where the guarantees stop. DTLS encrypts the channel to whichever certificate the other side presented. If the wrong certificate was introduced, the encryption works perfectly and protects the conversation with the wrong party. The stages of a P2P transfer show where that introduction happens: in signaling, before any file data flows.

Who can see what in a peer-to-peer file transferThe sender and receiver share a DTLS-encrypted data channel, and each learns the other's IP address. A network observer sees only encrypted packets and their volume. The signaling server forwards the offers and key fingerprints, which makes it the point where keys could be substituted. A TURN relay, when used, sees both IP addresses, traffic volume and timing, but not the file.Senderholds the fileReceivergets an unscanned fileDTLS-encrypted data channeleach peer learns the other's IP addressWi-Fi, ISP: ciphertext, volume, timingSignaling serverforwards offers, candidatesand key fingerprintstrust point: could swapkeys if maliciousTURN or relaysees both IPs, sizes, timing;content only if not sealedused when nodirect path opens
On the direct path, outsiders see only ciphertext. The peer sees your IP address, the signaling server introduces the keys, and a relay sees metadata.

What it exposes: IP addresses

To connect directly, each peer has to tell the other where it can be reached. ICE candidates carry IP addresses and ports, and a successful direct connection means each side has seen at least one working address of the other. A peer can therefore learn your public IP address, which is enough to estimate your city and your ISP.

Browsers limit how much they reveal. RFC 8828 defines four address-handling modes, from “enumerate all addresses” to “force proxy”, and recommends that without user consent a browser use the default route plus its associated local addresses. In practice that means the public address of the interface your web traffic already uses, not every network adapter on the machine.

VPNs

With a full-tunnel VPN, the default route goes through the tunnel, so the peer sees the VPN's exit address. RFC 8828 singles out split-tunnel VPNs as the main privacy concern: if WebRTC traffic is allowed to bypass the tunnel, the peer can see your ISP address as well as the VPN address. A VPN that blocks UDP may also push the connection onto a relay, which changes who sees your address rather than hiding it.

Relays see addresses too

Forcing traffic through a TURN relay hides your address from the peer, but the TURN provider then sees both addresses, the volume and the timing. It cannot read the file, because DTLS runs end to end between the peers and TURN only forwards the packets. The STUN and TURN explainer covers what each server type learns.

Who is on the other end? Peer authentication

Most P2P tools answer “who is the other peer” with “whoever had the code”. That is three separate questions:

  • Admission. Who may join? A session code or link is a shared secret; anyone who sees it over your shoulder or in a chat log can try to use it. Host approval, single-use codes and short expiry all shrink that window.
  • Key binding. Is the key I am encrypting to really the key of the person I admitted? In WebRTC the DTLS certificate fingerprints travel inside the SDP offer and answer, through the signaling server. An operator who controls signaling can replace both fingerprints with its own and sit in the middle; both sides still see an encrypted connection.
  • Verification. Can the two humans confirm it? Messengers do this with safety numbers or short codes that both people compare out of band. A password-authenticated key exchange (PAKE), as used by Magic Wormhole, binds the key to a short code the server never learns, so a server cannot substitute keys without guessing that code.

The honest framing for most browser tools is that they protect you against the network and against a passive server, and that you trust the signaling operator not to run an active attack. That is the same trust you place in any web app that serves its own JavaScript, but it should be stated, not hidden.

The file itself: malware and integrity

Encryption protects a file on the way; it says nothing about what the file does when opened. A storage service may scan uploads; a direct transfer has no such checkpoint, because no server ever holds the plaintext. If the tool is end-to-end encrypted, no server could scan it even if it wanted to. The receiver is the only place a check can happen.

  • Treat a received file like an email attachment from the same person: expected, or suspicious.
  • Check that the type matches the name. An invoice.pdf.exe is still an executable, and archives can contain anything.
  • For software or datasets, compare a SHA-256 hash the sender gives you through a different channel. Transport integrity (DTLS, AES-GCM tags) proves the bytes were not changed on the way, not that the sender sent the right thing.
  • Open untrusted documents in a sandbox or viewer, and let local antivirus scan the Downloads folder as usual.

Tools should also treat file names from a peer as untrusted input: a name like ../../.bashrc must never become a path outside the download folder. The OWASP file upload guidance applies to receivers as much as to servers.

SRIFT does not scan files. Browser transfers are protected by DTLS on the direct path and an authentication tag on every relay chunk, plus a byte-count confirmation at the end, but there is no whole-file hash in browser sessions. AgentNet file transfers between agents do verify a SHA-256 of the complete file.

The relay fallback: sealed or just TLS?

Every practical P2P tool needs a relay for networks where no direct path opens. How that relay is built decides whether “end-to-end encrypted” survives the fallback.

  • TURN relays forward the same DTLS packets the peers would have exchanged directly. The encryption is still end to end.
  • Application relays, such as a WebSocket server that forwards chunks, are only end-to-end encrypted if the client seals each chunk before sending, with a key the relay does not have. If the relay connection is merely HTTPS, the relay decrypts TLS and sees the file. This is the distinction drawn in end-to-end encryption vs TLS.

Ask specifically which applies, and whether there is a weaker legacy mode the tool falls back to without telling you.

Public torrent swarms vs private sessions

BitTorrent is also peer to peer, with a very different threat model. A public swarm is open by design: anyone who has the magnet link or finds the torrent can join, and every peer and tracker in it can see the IP addresses of the others. Pieces are checked against hashes, so integrity is strong, but the content itself is not confidential. That is the right design for distributing a public Linux image and the wrong one for a contract.

A private transfer session has two or a few known parties, an admission step, and encryption to those parties only. SRIFT can use WebTorrent, but it is opt-in, and public trackers are a separate opt-in, because WebTorrent seeds unencrypted pieces and a public tracker would let strangers fetch them.

Questions to ask any P2P transfer tool

These questions apply to any tool, open source or not. The right-hand column gives SRIFT's answers as of version 4.3.2, including the ones that are not flattering.

A security checklist for P2P file transfer tools, with SRIFT 4.3.2 answers.
QuestionWhy it mattersSRIFT's answer
How is the direct path encrypted?Rules out plaintext on the network.WebRTC DTLS between the two browsers. No additional application-level layer on the direct path.
Is the relay path end-to-end encrypted?The fallback is where weaker tools leak.Yes for current clients: per-transfer ECDH key, AES-256-GCM per chunk. Older clients fall back to a session-code key the server can derive.
Who can join a session?A leaked code should not be enough.Session code plus host approval of each join request.
How are keys verified?Decides whether the server could sit in the middle.Introduced through the SRIFT server; no verification screen yet. CLI peers can add --room-secret.
What does the server see?Metadata reveals who, when and what size.File names, sizes and types, participants, IP addresses, timing, and WebRTC offers and candidates.
Is anything stored?Stored copies outlive the transfer.File bytes are streamed, not stored. Server state is RAM only; idle sessions are dropped after 7 days.
Who learns my IP address?Location and ISP exposure.The peer on a direct WebRTC path, the SRIFT server, and TURN providers when used.
Are received files scanned?Encryption does not stop malware.No. Check files before opening them.
Is a shared link a bearer secret?Anyone holding it may be able to download.Yes. Use --encrypt, --password, --once or --ttl, and srift links revoke to cut a link off.
Can the claims be checked?Security claims should be verifiable.The code is open source (SRIFT-Open_Source on GitHub).

For a summary of the product side of this, see encrypted file sharing with SRIFT.

Frequently asked questions

Can someone hack my computer through a P2P file transfer?

The connection itself only delivers data to the transfer app, so the realistic risks are a bug in that app and, far more often, a malicious file that you then open. Keep the app and browser updated and check received files before opening them.

Does a VPN make P2P file transfer more private?

A full-tunnel VPN means the other peer sees the VPN's exit address instead of yours. A split-tunnel VPN can let WebRTC reveal your ISP address as well, and a VPN that blocks UDP may push the transfer onto a relay, which then sees your address instead.

Is P2P transfer safer than a cloud storage link?

It removes the stored copy and the provider's access to it, which is a significant gain. In exchange, the peer sees your IP address and there is no server-side virus scan. Which matters more depends on whether you fear a leak of the file or contact with the recipient.

References

  1. RFC 8826: Security Considerations for WebRTC (IETF)
  2. RFC 8827: WebRTC Security Architecture (IETF)
  3. RFC 8828: WebRTC IP Address Handling Requirements (IETF)
  4. WebRTC: Real-Time Communication in Browsers (W3C)
  5. File Upload Cheat Sheet (OWASP)
  6. Magic Wormhole: Welcome (PAKE and security) (Magic Wormhole)

See exactly what SRIFT encrypts

Every key, algorithm and metadata field — including what servers can see and what the design does not stop.