skip to content

SRTP

Encryption and authentication applied to RTP media itself: counter-mode and GCM profiles, keys derived from a DTLS handshake, and a replay window. Interviewers reach for it when media runs over UDP.

on this pageshow

explore

questions

26

In SRTP, why does encrypting the RTP payload not stop an attacker from replaying recorded video packets or flipping bits in them?

level: juniorimportance: must knowfreq 42%

answer

  1. confidentiality is not integrity
  2. counter mode: flipped bit, flipped bit
  3. a recorded packet decrypts fine twice
  4. tag over header, payload and ROC
  5. replay list over the 48-bit index

basics

~20 s

Encryption hides content but never fails: flipped bits in SRTP counter-mode ciphertext decrypt to the same flipped plaintext bits, and a recorded packet decrypts fine when re-sent. SRTP adds an authentication tag and a replay list to catch both.

solid answer

~50 s

SRTP's default cipher, AES in counter mode, XORs a keystream onto the payload, so decryption accepts anything: flip a ciphertext bit and the same plaintext bit flips, and a packet recorded earlier decrypts exactly as it did the first time. RFC 3711 closes both gaps at the receiver. An **authentication tag** (HMAC-SHA1, 80 bits by default) covers the RTP header, the encrypted payload and the rollover counter, so an edited packet fails verification. A **replay list**, in practice a sliding window of at least 64 packet indices, remembers which 48-bit indices were already accepted, so a genuine packet sent a second time is refused. The two depend on each other: without the tag an attacker could rewrite a replayed packet's sequence number, which is why RFC 3711 says secure replay protection is only possible with integrity protection. Either failure means the packet is discarded and the event logged.

go deeper

for a junior

Recall that SRTP gives three things, not one: confidentiality, integrity and replay protection. Be ready to say that encryption alone lets a recorded packet be re-sent and lets bits be flipped unnoticed.

for a middle

Explain the mechanics: counter mode XORs a keystream, so a flipped ciphertext bit flips the same plaintext bit; the tag covers header, ciphertext and ROC; the replay list remembers accepted 48-bit indices.

for a senior

Show why each check needs the other: a replayed packet carries a genuine tag, and without a tag the sequence number can be rewritten. Tie it to when null or weak authentication is acceptable at all.

for a principal

Frame it as a risk decision: RFC 3711 permits weak or null authentication only under narrow conditions. Be able to argue which media, such as surveillance or anything driving decisions, rules that out entirely.

## What encryption gives SRTP, and what it does not **SRTP** (Secure Real-time Transport Protocol, RFC 3711) protects RTP media. Its default cipher is **AES in counter mode** (AES-CM): the sender generates a keystream from the session key, the stream's SSRC and the packet index, and XORs it onto the RTP payload. The receiver regenerates the same keystream and XORs it off. That gives **confidentiality**: someone on the path cannot read the video. It gives nothing else. RFC 3711 says so directly: encryption algorithms, including AES counter mode, do not provide message authentication. Decryption with an additive stream cipher never "fails" — it always produces *some* plaintext. Two consequences follow, and both matter on a video stream: - **Bit flipping.** If an attacker flips bit *n* of the ciphertext, bit *n* of the decrypted payload flips. The receiver has no way to notice from decryption alone. - **Replay.** A packet captured earlier is a perfectly valid ciphertext. Re-sent later, it decrypts to exactly the frame it carried the first time. RFC 3711's own example of a replay that matters is a surveillance camera: store its output for a while, then inject it towards the monitoring station so that the station shows a quiet corridor. Encryption does not stop it. ## Two attacks on one stream, and what catches each | Attack on an SRTP video stream | What decryption does | What the receiver uses to catch it | |---|---|---| | Re-send a captured burst of genuine packets | Decrypts them perfectly | The **replay list**: those indices were already accepted | | Flip bits in another packet's payload or header | Produces altered plaintext, silently | The **authentication tag**: recomputed tag does not match | | Edit a replayed packet's sequence number so it looks new | Decrypts to noise, since the keystream depends on the index, and flags nothing | The **authentication tag**: the header is authenticated | ## The authentication tag The tag is the one SRTP field (besides the optional MKI) that plain RTP does not have. For SRTP the tag is computed over the **Authenticated Portion** — the RTP header followed by the encrypted payload — concatenated with the **rollover counter** (ROC), the 32-bit count of sequence-number wraps that both ends keep but never send. The default transform is HMAC-SHA1 with an 80-bit tag; which algorithm and length a session actually uses is chosen by its protection profile. The receiver recomputes the tag over what arrived and compares. Any change to the header, the ciphertext or the implied ROC changes the tag, so the packet is rejected. Note what is *not* encrypted: the RTP header, including the sequence number, travels in clear. It is protected against change, not against reading. ## The replay list Every SRTP packet has a **48-bit index**: `i = 2^16 × ROC + SEQ`, where SEQ is the 16-bit RTP sequence number. The receiver keeps a **replay list** of indices it has already received and authenticated. Conceptually it holds every index; in practice RFC 3711 allows a **sliding window**: indices more than `SRTP-WINDOW-SIZE` behind the highest one are simply assumed received. The window size is a receiver-side choice that MUST be at least 64. A captured burst re-sent a second later carries indices the receiver has already marked, so each one is refused. A burst re-sent much later carries indices that have fallen behind the window, so those are refused too. ## Why the two need each other 1. **Tag without replay list:** a re-sent packet carries the *genuine* tag the sender computed, so the tag check passes. Integrity alone does not stop replay — RFC 3711 says exactly that. 2. **Replay list without tag:** the attacker rewrites the sequence number of a recorded packet so its index lands ahead of the window, and the receiver accepts it. Hence RFC 3711: secure replay protection is only possible when integrity protection is present, and the tag "indirectly provides replay protection by authenticating the sequence number". 3. **Together:** the tag pins the index to the packet, and the replay list refuses any index seen before. Including the ROC in the tag input closes one more gap: a packet recorded in one cycle of the 16-bit sequence space cannot be passed off as the packet with the same SEQ 65,536 packets later, because the receiver would compute the tag with a different ROC. ## What happens on failure A packet that fails either check MUST be discarded, and the event SHOULD be logged. Nothing is sent back to the sender; SRTP defines no error message for it. RFC 3711 allows SRTP without authentication only where both of its conditions hold, and says null authentication MUST NOT be used where a replay could have a non-negligible impact — the camera case is exactly that.

  • If an SRTP session runs with null authentication, does the replay window still protect the stream?
    No. RFC 3711 says secure replay protection is only possible when integrity protection is present. Without a tag, an attacker can rewrite a recorded packet's sequence number so its index lands ahead of the window, and the receiver cannot tell. RFC 3711 also says null authentication MUST NOT be used where a replay could have a non-negligible impact, such as re-injected surveillance-camera output.
  • Why does the SRTP authentication tag cover the rollover counter, which is never sent on the wire?
    For SRTP the tag input is the Authenticated Portion concatenated with the ROC. That binds the tag to the full 48-bit index rather than the 16-bit sequence number, so a packet recorded in one sequence-number cycle cannot be replayed as the packet with the same SEQ one wrap later: the receiver would compute the tag with the next ROC and it would not match. The price is that a receiver holding the wrong ROC fails every tag.

saying these in an interview costs you the question

  • Encryption already stops tampering, because the attacker cannot read what they change.
  • A tampered SRTP packet fails to decrypt, so no separate integrity check is needed.
  • The tag check alone stops replays, because a re-sent packet must carry a forged tag.
  • The replay window works without authentication, since it only looks at sequence numbers.
  • SRTP encrypts the RTP header, so the sequence number cannot be read or changed.
open as a page

Why is a SIP call's media sent as plain RTP over UDP unsafe on a shared office LAN, and what does SRTP add?

level: juniorimportance: must knowfreq 45%

basics

~20 s

Plain RTP carries no encryption, integrity check or replay protection: anyone seeing the packets can decode the audio, and anyone reaching the port can inject or replay media. SRTP adds payload encryption, whole-packet authentication and replay protection.

open as a page

In SRTP's default protection profile, AES_CM_128_HMAC_SHA1_80, what does each part of the name select, and why is there a 112-bit salt?

level: middleimportance: must knowfreq 30%

basics

~20 s

AES_CM_128_HMAC_SHA1_80 is AES counter mode under a 128-bit master key for confidentiality, plus HMAC-SHA1 truncated to an 80-bit tag for integrity. The 112-bit salt, beside a 16-bit block counter, fills each counter block and blunts precomputation.

open as a page

Why is keying SRTP with SDES a=crypto lines considered unsafe, and how does DTLS-SRTP avoid the same weakness?

level: middleimportance: must knowfreq 28%

basics

~20 s

SDES puts each sender's SRTP master key in the SDP, so every proxy, log or trace that reads the signalling can decrypt the media. DTLS-SRTP derives keys in a handshake on the media path; signalling carries only a certificate fingerprint.

open as a page

How does an SRTP receiver's sliding replay window decide whether an arriving packet's 48-bit index is accepted or discarded?

level: middleimportance: must knowfreq 30%

basics

~20 s

An SRTP receiver accepts an index ahead of its highest authenticated index, or inside the window and unseen; it discards one already marked or too far behind. The window, at least 64 packets, is marked only after the tag verifies.

open as a page

In the 12-byte RTP fixed header, what do the payload type, sequence number, timestamp and SSRC each tell a receiver?

level: middleimportance: must knowfreq 30%

basics

~20 s

The payload type names the codec, the sequence number (+1 per packet) reveals loss and reordering, the timestamp counts media-clock ticks of the sampling instant for playout and jitter, and the SSRC identifies which source the packet belongs to.

open as a page

In SRTP, how does SRTCP protect RTCP control packets differently from SRTP data packets, and why is its authentication mandatory?

level: middleimportance: must knowfreq 24%

basics

~20 s

SRTCP appends an encrypt flag, an explicit 31-bit SRTCP index and a mandatory authentication tag to each RTCP compound packet, because RTCP has no sequence number to derive an index from and forged reports or BYEs could disrupt the session.

open as a page

In a WebRTC call keyed with DTLS-SRTP, is the audio carried inside DTLS records, and if not, what does the DTLS handshake contribute?

level: juniorimportance: should knowfreq 20%

basics

~20 s

No. DTLS-SRTP uses DTLS only to authenticate the peers, agree a protection profile through the use_srtp extension and export keying material; RTP and RTCP are then protected by SRTP itself and never sent as DTLS application data.

open as a page

How is an SRTP protection profile named and chosen in an SDES a=crypto offer versus a DTLS-SRTP use_srtp handshake?

level: middleimportance: should knowfreq 18%

basics

~20 s

SDES names a profile as a text crypto-suite, one per a=crypto line in preference order, and the answerer echoes the tag and suite of the first it supports. DTLS-SRTP lists two-byte SRTPProtectionProfile codes in use_srtp; the server returns one it was offered.

open as a page

An SRTP packet carries only a 16-bit sequence number; how does the receiver estimate the 32-bit rollover counter near a wrap?

level: middleimportance: should knowfreq 14%

basics

~20 s

An SRTP receiver tries ROC-1, ROC and ROC+1 with the packet's sequence number and picks whichever 48-bit index lies closest to its highest index, 2^16 x ROC + s_l; it updates ROC and s_l only after the packet authenticates.

open as a page

In plain RTCP, what do sender and receiver reports carry, and what can a forged RTCP packet do to a call?

level: middleimportance: should knowfreq 14%

basics

~20 s

Sender reports carry an NTP and RTP timestamp pair plus packet and octet counts; both report types carry loss, jitter and round-trip fields. Forged RTCP can remove a participant (BYE), fake loss that drives adaptation, or break synchronisation.

open as a page

In SDP, what do the RTP/AVP, RTP/SAVP, RTP/SAVPF and UDP/TLS/RTP/SAVPF transport profiles signal, and what happens when two endpoints' profiles do not match?

level: middleimportance: should knowfreq 20%

basics

~20 s

The m= line's proto token says how media is carried: plain RTP (RTP/AVP), SRTP (RTP/SAVP), SRTP with RTCP feedback (RTP/SAVPF), or SRTP keyed by DTLS over UDP (UDP/TLS/RTP/SAVPF). Secure and plain profiles cannot mix, so a mismatch rejects that stream.

open as a page

When an SRTP session moves from AES_CM_128_HMAC_SHA1_80 to RFC 7714's AEAD_AES_128_GCM, what changes in the packet, the keys and the operator's obligations?

level: seniorimportance: should knowfreq 12%

basics

~20 s

AEAD_AES_128_GCM replaces HMAC-SHA1 with one untruncated 16-octet AEAD tag, so packets grow 16 bytes, not 10. The salt shrinks to 96 bits to form a 12-octet IV, no separate authentication key is used, and the IV inputs must never repeat under one key.

open as a page

A narrow VoIP trunk team proposes SRTP's AES_CM_128_HMAC_SHA1_32 to save bandwidth; what does the 32-bit tag save, what does it risk, and why does SRTCP keep 80 bits?

level: seniorimportance: should knowfreq 14%

basics

~20 s

The 32-bit tag saves 6 bytes per SRTP packet, 2.4 kbit/s on a 50-packet-per-second stream, but a forged packet passes with probability 2^-32 instead of 2^-80. RFC 3711 forbids weak SRTCP authentication, so RTCP keeps 80 bits.

open as a page

In DTLS-SRTP, what does the SDP a=fingerprint attribute bind, and why does media security still depend on the signalling path?

level: seniorimportance: should knowfreq 15%

basics

~20 s

The a=fingerprint attribute carries a hash of the certificate each endpoint will present in the DTLS handshake, so self-signed certificates can be trusted. Whoever can alter the SDP can substitute a fingerprint and sit in the middle, so signalling needs integrity.

open as a page

In what order does an SRTP receiver run the replay check, tag verification, decryption and state update, and why are failures discarded silently?

level: seniorimportance: should knowfreq 18%

basics

~20 s

RFC 3711 has the SRTP receiver check the replay list, verify the tag, decrypt, then update ROC, s_l and the replay list. A failure is discarded and logged locally; nothing goes back to an unverified sender.

open as a page

After a long gap, an SRTP video stream resumes but the receiver discards every packet as an authentication failure; how can rollover-counter desynchronisation cause this, and how is it prevented?

level: seniorimportance: should knowfreq 16%

basics

~20 s

SRTP's tag check depends on the rollover counter, which is never sent. If the receiver's ROC is wrong, every tag fails, and because ROC only advances on a verified packet, the receiver never recovers by itself.

open as a page

A plain RTP receiver judges packets only by SSRC and sequence number; why does that let an on-path attacker inject or replay audio, and what closes the gap?

level: seniorimportance: should knowfreq 16%

basics

~20 s

RTP's sequence check exists to detect loss and source restarts, not attackers: in-range packets, duplicates and resynchronising runs are all accepted, and nothing authenticates the sender. SRTP's authentication tag plus its replay list close the gap.

open as a page

On an SRTP-protected call, what can an on-path observer still read from each packet, and why does SRTP leave the RTP header unencrypted?

level: seniorimportance: should knowfreq 18%

basics

~20 s

Under SRTP the observer still reads the whole RTP header — payload type, sequence number, timestamp, SSRC, CSRCs, extensions — plus packet sizes and timing. RFC 3711 leaves headers in clear for header compression; they are authenticated, not encrypted.

open as a page

A caller's SRTP-protected SIP INVITE forks to two phones that both send early media; why can the caller hear silence or clipping, and how do SDES and DTLS-SRTP differ?

level: seniorimportance: should knowfreq 10%

basics

~20 s

With SDP security descriptions each callee's sending key arrives only in its own answer, so early media that races ahead cannot be decrypted, and forked streams cannot be matched to keys. DTLS-SRTP keys each callee on its own media-path association.

open as a page

On a WebRTC media port shared by STUN, DTLS and SRTP, how does the receiver classify each packet, and what breaks when classification fails?

level: seniorimportance: should knowfreq 14%

basics

~20 s

The receiver reads the first byte: 0-3 is STUN, 20-63 DTLS, 128-191 RTP or RTCP (RFC 7983, updated by RFC 9443). With rtcp-mux the second byte then separates RTCP from RTP; misrouted or unmatched packets are dropped, so media goes silent.

open as a page

A calling platform bridges WebRTC browsers to a SIP trunk that supports only SDES; how would you design SRTP keying across the two legs, and what does each leg trust?

level: principalimportance: should knowfreq 10%

basics

~20 s

Terminate each leg at a gateway: DTLS-SRTP toward browsers, SDES toward the trunk, decrypting and re-encrypting between them. The browser leg trusts signalling integrity for fingerprints; the trunk leg trusts every signalling hop with keys, so harden and shrink that path.

open as a page

In SRTP, how does the AES-CM key derivation turn one master key and master salt into separate session keys?

level: middleimportance: nice to knowfreq 8%

basics

~20 s

SRTP runs AES in counter mode, keyed by the master key, over a one-byte label plus the packet index divided by the key derivation rate, XORed with the master salt. Labels 0x00 to 0x05 yield SRTP and SRTCP encryption, authentication and salting keys.

open as a page

An SRTP media leg kept open for months nears its master-key packet limit; how is it re-keyed, and why can a non-zero key derivation rate not postpone the limit?

level: seniorimportance: nice to knowfreq 6%

basics

~20 s

RFC 3711 caps a master key at 2^48 SRTP or 2^31 SRTCP packets; before either, key management must install a new master key, through a fresh DTLS handshake or SDES offer, or end the session. Session-key re-derivation cannot stretch that cap.

open as a page

For SRTP protection profiles on a calling platform with WebRTC clients and a narrow SIP trunk, do you set a policy or take each library's default, and what goes in it?

level: principalimportance: nice to knowfreq 6%

basics

~20 s

Set a policy, because a default is just one stack's choice. Support SRTP_AES128_CM_HMAC_SHA1_80 as WebRTC's mandatory baseline, offer the AES-GCM profiles first where every hop can meet their rules, forbid NULL encryption, and allow the 32-bit tag only on the bandwidth-bound trunk.

open as a page

Designing media security for a border controller between WebRTC clients and a SIP carrier, when would you terminate and re-originate SRTP rather than relay it end to end?

level: principalimportance: nice to knowfreq 6%

basics

~20 s

Terminate whenever the legs differ: WebRTC must use DTLS-SRTP and may not use SDES, while carriers often accept only plain RTP or SDES-keyed SRTP. Relay end to end only when both ends share keying and the border needs no media access.

open as a page