SlideShare a Scribd company logo
Fuzzing Janus for Fun and Profit
A. Amirante, T. Castaldi, L. Miniero, S.P. Romano, P. Saviano, A. Toppi
IPTComm 2019
October 15th 2019, Chicago, IL, USA
A few words about me
Lorenzo Miniero
• Ph.D @ UniNA
• Chairman @ Meetecho
• Main author of Janus®
Contacts and info
• lorenzo@meetecho.com
• https://twitter.com/elminiero
• https://www.slideshare.net/LorenzoMiniero
Vulnerabilities in RTC communications
• Project Zero is a team of security analysts employed by Google
• https://googleprojectzero.blogspot.com/
• Recently focused on videoconferencing applications
• Focus on end-to-end, and RTP testing
• Malicious endpoint generating randomized input
• Built new tools required for the task
• Targeted many applications, and found dangerous bugs
• Apple FaceTime
• WhatsApp
• WebRTC
Philipp Hancke’s wakeup call
https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
Vulnerabilities in RTC communications
• Project Zero is a team of security analysts employed by Google
• https://googleprojectzero.blogspot.com/
• Recently focused on videoconferencing applications
• Focus on end-to-end, and RTP testing
• Malicious endpoint generating randomized input
• Built new tools required for the task
• Targeted many applications, and found dangerous bugs
• Apple FaceTime
• WhatsApp
• WebRTC
Philipp Hancke’s wakeup call
https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
Vulnerabilities in RTC communications
• Project Zero is a team of security analysts employed by Google
• https://googleprojectzero.blogspot.com/
• Recently focused on videoconferencing applications
• Focus on end-to-end, and RTP testing
• Malicious endpoint generating randomized input
• Built new tools required for the task
• Targeted many applications, and found dangerous bugs
• Apple FaceTime
• WhatsApp
• WebRTC
Philipp Hancke’s wakeup call
https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
Vulnerabilities in RTC communications
• Project Zero is a team of security analysts employed by Google
• https://googleprojectzero.blogspot.com/
• Recently focused on videoconferencing applications
• Focus on end-to-end, and RTP testing
• Malicious endpoint generating randomized input
• Built new tools required for the task
• Targeted many applications, and found dangerous bugs
• Apple FaceTime
• WhatsApp
• WebRTC
Philipp Hancke’s wakeup call
https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
What can cause trouble in WebRTC?
• WebRTC is signalling agnostic, so typically not that
• You can use SIP, XMPP, some JSON flavour, etc.
• A lot of media-related protocols to worry about, though
• STUN/TURN (NAT traversal)
• DTLS/DTLS-SRTP (secure exchange of keys and data)
• RTP/RTCP (or actually, SRTP/SRTCP), including RTP extensions
• SCTP (data channels)
• ... and codec specific payloads
• Identifying keyframes (VP8, VP9, H.264)
• Simulcast & SVC (inspecting payloads)
What can cause trouble in WebRTC?
• WebRTC is signalling agnostic, so typically not that
• You can use SIP, XMPP, some JSON flavour, etc.
• A lot of media-related protocols to worry about, though
• STUN/TURN (NAT traversal)
• DTLS/DTLS-SRTP (secure exchange of keys and data)
• RTP/RTCP (or actually, SRTP/SRTCP), including RTP extensions
• SCTP (data channels)
• ... and codec specific payloads
• Identifying keyframes (VP8, VP9, H.264)
• Simulcast & SVC (inspecting payloads)
What can cause trouble in WebRTC?
• WebRTC is signalling agnostic, so typically not that
• You can use SIP, XMPP, some JSON flavour, etc.
• A lot of media-related protocols to worry about, though
• STUN/TURN (NAT traversal)
• DTLS/DTLS-SRTP (secure exchange of keys and data)
• RTP/RTCP (or actually, SRTP/SRTCP), including RTP extensions
• SCTP (data channels)
• ... and codec specific payloads
• Identifying keyframes (VP8, VP9, H.264)
• Simulcast & SVC (inspecting payloads)
Why can fuzz testing help?
• Automated software testing technique
• Unexpected or invalid data submitted to a program
• Input pattern modified according to a defined strategy (e.g., for coverage)
• Typical workflow
1 Engine generates input based on existing dataset (“Corpus”)
2 Input mutated slightly over time
3 Input data passed to target function and monitored (e.g., via sanitizers)
4 Coverage of new lines updates stats and Corpus (new pattern)
5 Repeat until it crashes
• Repeatability can be ensured using the same seeds or previous dumps
Why can fuzz testing help?
• Automated software testing technique
• Unexpected or invalid data submitted to a program
• Input pattern modified according to a defined strategy (e.g., for coverage)
• Typical workflow
1 Engine generates input based on existing dataset (“Corpus”)
2 Input mutated slightly over time
3 Input data passed to target function and monitored (e.g., via sanitizers)
4 Coverage of new lines updates stats and Corpus (new pattern)
5 Repeat until it crashes
• Repeatability can be ensured using the same seeds or previous dumps
Why can fuzz testing help?
• Automated software testing technique
• Unexpected or invalid data submitted to a program
• Input pattern modified according to a defined strategy (e.g., for coverage)
• Typical workflow
1 Engine generates input based on existing dataset (“Corpus”)
2 Input mutated slightly over time
3 Input data passed to target function and monitored (e.g., via sanitizers)
4 Coverage of new lines updates stats and Corpus (new pattern)
5 Repeat until it crashes
• Repeatability can be ensured using the same seeds or previous dumps
Introducing the Janus WebRTC server
Janus
General purpose, open source WebRTC server
• https://github.com/meetecho/janus-gateway
• Demos and documentation: https://janus.conf.meetecho.com
• Community: https://groups.google.com/forum/#!forum/meetecho-janus
Modular architecture
• The core only implements the WebRTC stack
• JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ...
• Plugins expose Janus API over different “transports”
• Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg
• “Application” logic implemented in plugins too
• Users attach to plugins via the Janus core
• The core handles the WebRTC stuff
• Plugins route/manipulate the media/data
• Plugins can be combined on client side as “bricks”
• Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
Modular architecture
• The core only implements the WebRTC stack
• JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ...
• Plugins expose Janus API over different “transports”
• Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg
• “Application” logic implemented in plugins too
• Users attach to plugins via the Janus core
• The core handles the WebRTC stuff
• Plugins route/manipulate the media/data
• Plugins can be combined on client side as “bricks”
• Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
Modular architecture
• The core only implements the WebRTC stack
• JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ...
• Plugins expose Janus API over different “transports”
• Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg
• “Application” logic implemented in plugins too
• Users attach to plugins via the Janus core
• The core handles the WebRTC stuff
• Plugins route/manipulate the media/data
• Plugins can be combined on client side as “bricks”
• Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
Modular architecture
• The core only implements the WebRTC stack
• JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ...
• Plugins expose Janus API over different “transports”
• Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg
• “Application” logic implemented in plugins too
• Users attach to plugins via the Janus core
• The core handles the WebRTC stuff
• Plugins route/manipulate the media/data
• Plugins can be combined on client side as “bricks”
• Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
Choosing the fuzzing targets
• Many protocols via dependencies are fuzzed already
• ICE/STUN/TURN (libnice)
• DTLS/DTLS-SRTP (OpenSSL/LibreSSL/BoringSSL)
• SRTP/SRTCP (libsrtp)
• SCTP (usrsctplib)
• Some other dependencies MAY need fuzzing (but not in Janus?)
• Transports (HTTP, WebSockets, RabbitMQ, etc.)
• JSON support (Jansson)
• Custom code DEFINITELY needs fuzzing
• RTCP parsing (e.g., compound packets)
• RTP processing (e.g., RTP extensions, codec specific payloads)
• SDP parsing and processing
Choosing the fuzzing targets
• Many protocols via dependencies are fuzzed already
• ICE/STUN/TURN (libnice)
• DTLS/DTLS-SRTP (OpenSSL/LibreSSL/BoringSSL)
• SRTP/SRTCP (libsrtp)
• SCTP (usrsctplib)
• Some other dependencies MAY need fuzzing (but not in Janus?)
• Transports (HTTP, WebSockets, RabbitMQ, etc.)
• JSON support (Jansson)
• Custom code DEFINITELY needs fuzzing
• RTCP parsing (e.g., compound packets)
• RTP processing (e.g., RTP extensions, codec specific payloads)
• SDP parsing and processing
Choosing the fuzzing targets
• Many protocols via dependencies are fuzzed already
• ICE/STUN/TURN (libnice)
• DTLS/DTLS-SRTP (OpenSSL/LibreSSL/BoringSSL)
• SRTP/SRTCP (libsrtp)
• SCTP (usrsctplib)
• Some other dependencies MAY need fuzzing (but not in Janus?)
• Transports (HTTP, WebSockets, RabbitMQ, etc.)
• JSON support (Jansson)
• Custom code DEFINITELY needs fuzzing
• RTCP parsing (e.g., compound packets)
• RTP processing (e.g., RTP extensions, codec specific payloads)
• SDP parsing and processing
A quick intro to libFuzzer
• Popular coverage-guided fuzzing engine, part of the LLVM project
• https://llvm.org/docs/LibFuzzer.html
• Used by several well known applications
• glibc, OpenSSL/LibreSSL/BoringSSL, SQLite, FFmpeg and many more
• A few key characteristics
• Needs sources to be compiled with Clang
• Works in-process (linked with the library/application under test)
• Feeds inputs to the target via a fuzzing entrypoint (target function)
• Execution of the target function is monitored with sanitizers tools (e.g., libasan)
A quick intro to libFuzzer
• Popular coverage-guided fuzzing engine, part of the LLVM project
• https://llvm.org/docs/LibFuzzer.html
• Used by several well known applications
• glibc, OpenSSL/LibreSSL/BoringSSL, SQLite, FFmpeg and many more
• A few key characteristics
• Needs sources to be compiled with Clang
• Works in-process (linked with the library/application under test)
• Feeds inputs to the target via a fuzzing entrypoint (target function)
• Execution of the target function is monitored with sanitizers tools (e.g., libasan)
A quick intro to libFuzzer
• Popular coverage-guided fuzzing engine, part of the LLVM project
• https://llvm.org/docs/LibFuzzer.html
• Used by several well known applications
• glibc, OpenSSL/LibreSSL/BoringSSL, SQLite, FFmpeg and many more
• A few key characteristics
• Needs sources to be compiled with Clang
• Works in-process (linked with the library/application under test)
• Feeds inputs to the target via a fuzzing entrypoint (target function)
• Execution of the target function is monitored with sanitizers tools (e.g., libasan)
Coverage-guided fuzzing
libFuzzer in (simplified) practice
1 Implement the method to receive and process the input data
// my_fuzzer.c
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
ProcessData(Data, Size);
return 0;
}
2 Compile with Clang and the right flags
> clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c
3 Launch passing the Corpus folder as the argument
> ./my_fuzzer CORPUS_DIR
4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions)
> gdb --args ./my_fuzzer crash-file-dump
libFuzzer in (simplified) practice
1 Implement the method to receive and process the input data
// my_fuzzer.c
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
ProcessData(Data, Size);
return 0;
}
2 Compile with Clang and the right flags
> clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c
3 Launch passing the Corpus folder as the argument
> ./my_fuzzer CORPUS_DIR
4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions)
> gdb --args ./my_fuzzer crash-file-dump
libFuzzer in (simplified) practice
1 Implement the method to receive and process the input data
// my_fuzzer.c
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
ProcessData(Data, Size);
return 0;
}
2 Compile with Clang and the right flags
> clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c
3 Launch passing the Corpus folder as the argument
> ./my_fuzzer CORPUS_DIR
4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions)
> gdb --args ./my_fuzzer crash-file-dump
libFuzzer in (simplified) practice
1 Implement the method to receive and process the input data
// my_fuzzer.c
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
ProcessData(Data, Size);
return 0;
}
2 Compile with Clang and the right flags
> clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c
3 Launch passing the Corpus folder as the argument
> ./my_fuzzer CORPUS_DIR
4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions)
> gdb --args ./my_fuzzer crash-file-dump
Integrating libFuzzer in Janus
• First step was Clang support (Janus normally built with gcc)
• Streamlined compilation flags in the process
• Got useful warnings that led to some fixes too
• Next step was choosing what to fuzz
• Decided to start with RTCP
• Compound packets + length values + overflows = “fun”...
• Then worked on the libFuzzer workflow
1 Fuzzing target with critical RTCP-related functions
2 Helper script to build the fuzzer
3 Helper script to run the fuzzer
Original pull request (now merged, with RTP and SDP fuzzing as well)
https://github.com/meetecho/janus-gateway/pull/1492
Integrating libFuzzer in Janus
• First step was Clang support (Janus normally built with gcc)
• Streamlined compilation flags in the process
• Got useful warnings that led to some fixes too
• Next step was choosing what to fuzz
• Decided to start with RTCP
• Compound packets + length values + overflows = “fun”...
• Then worked on the libFuzzer workflow
1 Fuzzing target with critical RTCP-related functions
2 Helper script to build the fuzzer
3 Helper script to run the fuzzer
Original pull request (now merged, with RTP and SDP fuzzing as well)
https://github.com/meetecho/janus-gateway/pull/1492
Integrating libFuzzer in Janus
• First step was Clang support (Janus normally built with gcc)
• Streamlined compilation flags in the process
• Got useful warnings that led to some fixes too
• Next step was choosing what to fuzz
• Decided to start with RTCP
• Compound packets + length values + overflows = “fun”...
• Then worked on the libFuzzer workflow
1 Fuzzing target with critical RTCP-related functions
2 Helper script to build the fuzzer
3 Helper script to run the fuzzer
Original pull request (now merged, with RTP and SDP fuzzing as well)
https://github.com/meetecho/janus-gateway/pull/1492
Integrating libFuzzer in Janus
• First step was Clang support (Janus normally built with gcc)
• Streamlined compilation flags in the process
• Got useful warnings that led to some fixes too
• Next step was choosing what to fuzz
• Decided to start with RTCP
• Compound packets + length values + overflows = “fun”...
• Then worked on the libFuzzer workflow
1 Fuzzing target with critical RTCP-related functions
2 Helper script to build the fuzzer
3 Helper script to run the fuzzer
Original pull request (now merged, with RTP and SDP fuzzing as well)
https://github.com/meetecho/janus-gateway/pull/1492
Integrating libFuzzer in Janus
// fuzz-rtcp.c
#include "janus/rtcp.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (size < 8 || size > 1472)
return 0;
if (!janus_is_rtcp(data, size))
return 0;
/* Initialize an empty RTCP context */
janus_rtcp_context ctx;
janus_rtcp_parse(ctx, (char *)data, size);
GSList *list = janus_rtcp_get_nacks((char *)data, size);
...
if (list)
g_slist_free(list);
return 0;
}
Presenting the code coverage
Corpora files: a shared effort
https://github.com/RTC-Cartel/webrtc-fuzzer-corpora
Scalable distributed fuzzing via OSS-Fuzz
https://github.com/google/oss-fuzz/pull/2241 (Janus addition)
Scalable distributed fuzzing via OSS-Fuzz
https://github.com/google/oss-fuzz/pull/2241 (Janus addition)
A detailed tutorial on how to setup all this
https://webrtchacks.com/fuzzing-janus/
What’s next?
• So far, we only fuzzed RTP, RTCP and in part SDP in the core
• SDP fuzzing should be improved (maybe with structure-aware fuzzing?)
• What about plugins and their custom interactions?
• Definitely expand the corpora
• The shared RTC-Cartel repo should help with that
• Exchanging crash causes with other projects will make both more robust
• libFuzzer is not the only option here
• Some popular alternatives are AFL, Radamsa, Gasoline, etc.
• KITE and its “weaponised” browsers can be very helpful as an orthogonal testing tool
What’s next?
• So far, we only fuzzed RTP, RTCP and in part SDP in the core
• SDP fuzzing should be improved (maybe with structure-aware fuzzing?)
• What about plugins and their custom interactions?
• Definitely expand the corpora
• The shared RTC-Cartel repo should help with that
• Exchanging crash causes with other projects will make both more robust
• libFuzzer is not the only option here
• Some popular alternatives are AFL, Radamsa, Gasoline, etc.
• KITE and its “weaponised” browsers can be very helpful as an orthogonal testing tool
What’s next?
• So far, we only fuzzed RTP, RTCP and in part SDP in the core
• SDP fuzzing should be improved (maybe with structure-aware fuzzing?)
• What about plugins and their custom interactions?
• Definitely expand the corpora
• The shared RTC-Cartel repo should help with that
• Exchanging crash causes with other projects will make both more robust
• libFuzzer is not the only option here
• Some popular alternatives are AFL, Radamsa, Gasoline, etc.
• KITE and its “weaponised” browsers can be very helpful as an orthogonal testing tool
Thanks! Questions? Comments?
Get in touch!
• https://twitter.com/elminiero
• https://twitter.com/meetecho
• https://www.meetecho.com

More Related Content

PDF
Write a SocialTV app @ OpenSIPS 2021
PDF
Janus/SIP @ OpenSIPS 2017
PDF
SIP/WebRTC load testing @ KamailioWorld 2017
PDF
Virtual IETF meetings with WebRTC @ IETF 109 MOPS
PDF
WebRTC security+more @ KamailioWorld 2018
PDF
WebRTC, RED and Janus @ ClueCon21
PDF
IETF remote participation via Meetecho @ WebRTC Meetup Stockholm
PDF
Fuzzing RTC @ Kamailio World 2019
Write a SocialTV app @ OpenSIPS 2021
Janus/SIP @ OpenSIPS 2017
SIP/WebRTC load testing @ KamailioWorld 2017
Virtual IETF meetings with WebRTC @ IETF 109 MOPS
WebRTC security+more @ KamailioWorld 2018
WebRTC, RED and Janus @ ClueCon21
IETF remote participation via Meetecho @ WebRTC Meetup Stockholm
Fuzzing RTC @ Kamailio World 2019

What's hot (20)

PDF
Janus Workshop pt.2 @ ClueCon 2021
PDF
Janus + Audio @ Open Source World
PDF
Janus/HOMER/HEPIC @ OpenSIPS18
PDF
Janus/SIP @ OpenSIPS 2019
PDF
Can WebRTC help musicians? @ FOSDEM 2021
PDF
Scaling WebRTC applications with Janus
PDF
Can SFUs and MCUs be friends @ IIT-RTC 2020
PDF
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...
PDF
Insertable Streams and E2EE @ ClueCon2020
PDF
Janus @ WebRTC Meetup Stockholm
PDF
Janus + NDI @ ClueCon 2021
PDF
WHIP and Janus @ IIT-RTC 2021
PDF
Janus Workshop @ ClueCon 2020
PDF
FOSDEM2018 Janus Lua plugin presentation
PDF
Turning live events to virtual with Janus
PDF
Janus: an open source and general purpose WebRTC (gateway) server
PDF
Scaling WebRTC deployments with multicast @ IETF 110 MBONED
PDF
WHIP WebRTC Broadcasting @ FOSDEM 2022
PDF
Janus @ ClueCon 2019
PDF
Simulcast/SVC @ IIT-RTC 2019
Janus Workshop pt.2 @ ClueCon 2021
Janus + Audio @ Open Source World
Janus/HOMER/HEPIC @ OpenSIPS18
Janus/SIP @ OpenSIPS 2019
Can WebRTC help musicians? @ FOSDEM 2021
Scaling WebRTC applications with Janus
Can SFUs and MCUs be friends @ IIT-RTC 2020
Talk@JanusCon2019: Janus, WebRTC and ML - Fantastic technologies and how to m...
Insertable Streams and E2EE @ ClueCon2020
Janus @ WebRTC Meetup Stockholm
Janus + NDI @ ClueCon 2021
WHIP and Janus @ IIT-RTC 2021
Janus Workshop @ ClueCon 2020
FOSDEM2018 Janus Lua plugin presentation
Turning live events to virtual with Janus
Janus: an open source and general purpose WebRTC (gateway) server
Scaling WebRTC deployments with multicast @ IETF 110 MBONED
WHIP WebRTC Broadcasting @ FOSDEM 2022
Janus @ ClueCon 2019
Simulcast/SVC @ IIT-RTC 2019
Ad

Similar to Fuzzing Janus @ IPTComm 2019 (20)

PDF
Janus RTP forwarders @ FOSDEM 2020
PDF
Janus @ DevDay Napoli
PDF
Janus/Asterisk @ Astricon 2017
PDF
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
PDF
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
PDF
WebRTC and SIP not just audio and video @ OpenSIPS 2024
PDF
Janus conf'19: janus client side
PDF
Janus workshop @ RTC2019 Beijing
PDF
Scaling server side web rtc applications the janus challenge by lorenzo miniero
PDF
[workshop] The Revolutionary WebRTC
PPTX
DevCon5 (July 2014) - Intro to WebRTC
PDF
WebRTC and Janus intro for FOSS Stockholm January 2019
PDF
FOSDEM 2020: How can we make WebRTC Easier?
PDF
WebRTC - Is it ready? 2013
PDF
WebRTC: Mostly Video Bits
PDF
Demuxed 2020
PDF
DevCon 5 (December 2013) - WebRTC & WebSockets
PPTX
DeveloperWeek 2015 - WebRTC - Where to start and how to scale
PDF
WebRTC Rockstars Asian Tour 2017
Janus RTP forwarders @ FOSDEM 2020
Janus @ DevDay Napoli
Janus/Asterisk @ Astricon 2017
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
GiacomoVacca - WebRTC - troubleshooting media negotiation.pdf
WebRTC and SIP not just audio and video @ OpenSIPS 2024
Janus conf'19: janus client side
Janus workshop @ RTC2019 Beijing
Scaling server side web rtc applications the janus challenge by lorenzo miniero
[workshop] The Revolutionary WebRTC
DevCon5 (July 2014) - Intro to WebRTC
WebRTC and Janus intro for FOSS Stockholm January 2019
FOSDEM 2020: How can we make WebRTC Easier?
WebRTC - Is it ready? 2013
WebRTC: Mostly Video Bits
Demuxed 2020
DevCon 5 (December 2013) - WebRTC & WebSockets
DeveloperWeek 2015 - WebRTC - Where to start and how to scale
WebRTC Rockstars Asian Tour 2017
Ad

More from Lorenzo Miniero (13)

PDF
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
PDF
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
PDF
WebRTC and QUIC: how hard can it be? @ RTC.ON 2024
PDF
SIP trunking in Janus @ Kamailio World 2024
PDF
Getting AV1/SVC to work in the Janus WebRTC Server
PDF
WebRTC Broadcasting @ TADSummit 2023
PDF
BWE in Janus
PDF
The challenges of hybrid meetings @ CommCon 2023
PDF
Real-Time Text and WebRTC @ Kamailio World 2023
PDF
Become a rockstar using FOSS!
PDF
Janus SFU cascading @ IIT-RTC 2022
PDF
SIP transfer with Janus/WebRTC @ OpenSIPS 2022
PDF
JamRTC @ Wonder WebRTC unConference
Multistream in SIP and NoSIP @ OpenSIPS Summit 2025
RTP Over QUIC: An Interesting Opportunity Or Wasted Time?
WebRTC and QUIC: how hard can it be? @ RTC.ON 2024
SIP trunking in Janus @ Kamailio World 2024
Getting AV1/SVC to work in the Janus WebRTC Server
WebRTC Broadcasting @ TADSummit 2023
BWE in Janus
The challenges of hybrid meetings @ CommCon 2023
Real-Time Text and WebRTC @ Kamailio World 2023
Become a rockstar using FOSS!
Janus SFU cascading @ IIT-RTC 2022
SIP transfer with Janus/WebRTC @ OpenSIPS 2022
JamRTC @ Wonder WebRTC unConference

Recently uploaded (20)

PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PPTX
1. Introduction to Computer Programming.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
project resource management chapter-09.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Developing a website for English-speaking practice to English as a foreign la...
PDF
Hybrid model detection and classification of lung cancer
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
Tartificialntelligence_presentation.pptx
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
A novel scalable deep ensemble learning framework for big data classification...
Group 1 Presentation -Planning and Decision Making .pptx
Zenith AI: Advanced Artificial Intelligence
A contest of sentiment analysis: k-nearest neighbor versus neural network
1. Introduction to Computer Programming.pptx
Chapter 5: Probability Theory and Statistics
WOOl fibre morphology and structure.pdf for textiles
Programs and apps: productivity, graphics, security and other tools
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
cloud_computing_Infrastucture_as_cloud_p
project resource management chapter-09.pdf
A comparative study of natural language inference in Swahili using monolingua...
Univ-Connecticut-ChatGPT-Presentaion.pdf
Developing a website for English-speaking practice to English as a foreign la...
Hybrid model detection and classification of lung cancer
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
TLE Review Electricity (Electricity).pptx
Tartificialntelligence_presentation.pptx
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf

Fuzzing Janus @ IPTComm 2019

  • 1. Fuzzing Janus for Fun and Profit A. Amirante, T. Castaldi, L. Miniero, S.P. Romano, P. Saviano, A. Toppi IPTComm 2019 October 15th 2019, Chicago, IL, USA
  • 2. A few words about me Lorenzo Miniero • Ph.D @ UniNA • Chairman @ Meetecho • Main author of Janus® Contacts and info • lorenzo@meetecho.com • https://twitter.com/elminiero • https://www.slideshare.net/LorenzoMiniero
  • 3. Vulnerabilities in RTC communications • Project Zero is a team of security analysts employed by Google • https://googleprojectzero.blogspot.com/ • Recently focused on videoconferencing applications • Focus on end-to-end, and RTP testing • Malicious endpoint generating randomized input • Built new tools required for the task • Targeted many applications, and found dangerous bugs • Apple FaceTime • WhatsApp • WebRTC Philipp Hancke’s wakeup call https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
  • 4. Vulnerabilities in RTC communications • Project Zero is a team of security analysts employed by Google • https://googleprojectzero.blogspot.com/ • Recently focused on videoconferencing applications • Focus on end-to-end, and RTP testing • Malicious endpoint generating randomized input • Built new tools required for the task • Targeted many applications, and found dangerous bugs • Apple FaceTime • WhatsApp • WebRTC Philipp Hancke’s wakeup call https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
  • 5. Vulnerabilities in RTC communications • Project Zero is a team of security analysts employed by Google • https://googleprojectzero.blogspot.com/ • Recently focused on videoconferencing applications • Focus on end-to-end, and RTP testing • Malicious endpoint generating randomized input • Built new tools required for the task • Targeted many applications, and found dangerous bugs • Apple FaceTime • WhatsApp • WebRTC Philipp Hancke’s wakeup call https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
  • 6. Vulnerabilities in RTC communications • Project Zero is a team of security analysts employed by Google • https://googleprojectzero.blogspot.com/ • Recently focused on videoconferencing applications • Focus on end-to-end, and RTP testing • Malicious endpoint generating randomized input • Built new tools required for the task • Targeted many applications, and found dangerous bugs • Apple FaceTime • WhatsApp • WebRTC Philipp Hancke’s wakeup call https://webrtchacks.com/lets-get-better-at-fuzzing-in-2019-heres-how/
  • 7. What can cause trouble in WebRTC? • WebRTC is signalling agnostic, so typically not that • You can use SIP, XMPP, some JSON flavour, etc. • A lot of media-related protocols to worry about, though • STUN/TURN (NAT traversal) • DTLS/DTLS-SRTP (secure exchange of keys and data) • RTP/RTCP (or actually, SRTP/SRTCP), including RTP extensions • SCTP (data channels) • ... and codec specific payloads • Identifying keyframes (VP8, VP9, H.264) • Simulcast & SVC (inspecting payloads)
  • 8. What can cause trouble in WebRTC? • WebRTC is signalling agnostic, so typically not that • You can use SIP, XMPP, some JSON flavour, etc. • A lot of media-related protocols to worry about, though • STUN/TURN (NAT traversal) • DTLS/DTLS-SRTP (secure exchange of keys and data) • RTP/RTCP (or actually, SRTP/SRTCP), including RTP extensions • SCTP (data channels) • ... and codec specific payloads • Identifying keyframes (VP8, VP9, H.264) • Simulcast & SVC (inspecting payloads)
  • 9. What can cause trouble in WebRTC? • WebRTC is signalling agnostic, so typically not that • You can use SIP, XMPP, some JSON flavour, etc. • A lot of media-related protocols to worry about, though • STUN/TURN (NAT traversal) • DTLS/DTLS-SRTP (secure exchange of keys and data) • RTP/RTCP (or actually, SRTP/SRTCP), including RTP extensions • SCTP (data channels) • ... and codec specific payloads • Identifying keyframes (VP8, VP9, H.264) • Simulcast & SVC (inspecting payloads)
  • 10. Why can fuzz testing help? • Automated software testing technique • Unexpected or invalid data submitted to a program • Input pattern modified according to a defined strategy (e.g., for coverage) • Typical workflow 1 Engine generates input based on existing dataset (“Corpus”) 2 Input mutated slightly over time 3 Input data passed to target function and monitored (e.g., via sanitizers) 4 Coverage of new lines updates stats and Corpus (new pattern) 5 Repeat until it crashes • Repeatability can be ensured using the same seeds or previous dumps
  • 11. Why can fuzz testing help? • Automated software testing technique • Unexpected or invalid data submitted to a program • Input pattern modified according to a defined strategy (e.g., for coverage) • Typical workflow 1 Engine generates input based on existing dataset (“Corpus”) 2 Input mutated slightly over time 3 Input data passed to target function and monitored (e.g., via sanitizers) 4 Coverage of new lines updates stats and Corpus (new pattern) 5 Repeat until it crashes • Repeatability can be ensured using the same seeds or previous dumps
  • 12. Why can fuzz testing help? • Automated software testing technique • Unexpected or invalid data submitted to a program • Input pattern modified according to a defined strategy (e.g., for coverage) • Typical workflow 1 Engine generates input based on existing dataset (“Corpus”) 2 Input mutated slightly over time 3 Input data passed to target function and monitored (e.g., via sanitizers) 4 Coverage of new lines updates stats and Corpus (new pattern) 5 Repeat until it crashes • Repeatability can be ensured using the same seeds or previous dumps
  • 13. Introducing the Janus WebRTC server Janus General purpose, open source WebRTC server • https://github.com/meetecho/janus-gateway • Demos and documentation: https://janus.conf.meetecho.com • Community: https://groups.google.com/forum/#!forum/meetecho-janus
  • 14. Modular architecture • The core only implements the WebRTC stack • JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ... • Plugins expose Janus API over different “transports” • Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg • “Application” logic implemented in plugins too • Users attach to plugins via the Janus core • The core handles the WebRTC stuff • Plugins route/manipulate the media/data • Plugins can be combined on client side as “bricks” • Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
  • 15. Modular architecture • The core only implements the WebRTC stack • JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ... • Plugins expose Janus API over different “transports” • Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg • “Application” logic implemented in plugins too • Users attach to plugins via the Janus core • The core handles the WebRTC stuff • Plugins route/manipulate the media/data • Plugins can be combined on client side as “bricks” • Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
  • 16. Modular architecture • The core only implements the WebRTC stack • JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ... • Plugins expose Janus API over different “transports” • Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg • “Application” logic implemented in plugins too • Users attach to plugins via the Janus core • The core handles the WebRTC stuff • Plugins route/manipulate the media/data • Plugins can be combined on client side as “bricks” • Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
  • 17. Modular architecture • The core only implements the WebRTC stack • JSEP/SDP, ICE, DTLS-SRTP, Data Channels, Simulcast, VP9-SVC, ... • Plugins expose Janus API over different “transports” • Currently HTTP / WebSockets / RabbitMQ / Unix Sockets / MQTT / Nanomsg • “Application” logic implemented in plugins too • Users attach to plugins via the Janus core • The core handles the WebRTC stuff • Plugins route/manipulate the media/data • Plugins can be combined on client side as “bricks” • Video SFU, Audio MCU, SIP gatewaying, broadcasting, etc.
  • 18. Choosing the fuzzing targets • Many protocols via dependencies are fuzzed already • ICE/STUN/TURN (libnice) • DTLS/DTLS-SRTP (OpenSSL/LibreSSL/BoringSSL) • SRTP/SRTCP (libsrtp) • SCTP (usrsctplib) • Some other dependencies MAY need fuzzing (but not in Janus?) • Transports (HTTP, WebSockets, RabbitMQ, etc.) • JSON support (Jansson) • Custom code DEFINITELY needs fuzzing • RTCP parsing (e.g., compound packets) • RTP processing (e.g., RTP extensions, codec specific payloads) • SDP parsing and processing
  • 19. Choosing the fuzzing targets • Many protocols via dependencies are fuzzed already • ICE/STUN/TURN (libnice) • DTLS/DTLS-SRTP (OpenSSL/LibreSSL/BoringSSL) • SRTP/SRTCP (libsrtp) • SCTP (usrsctplib) • Some other dependencies MAY need fuzzing (but not in Janus?) • Transports (HTTP, WebSockets, RabbitMQ, etc.) • JSON support (Jansson) • Custom code DEFINITELY needs fuzzing • RTCP parsing (e.g., compound packets) • RTP processing (e.g., RTP extensions, codec specific payloads) • SDP parsing and processing
  • 20. Choosing the fuzzing targets • Many protocols via dependencies are fuzzed already • ICE/STUN/TURN (libnice) • DTLS/DTLS-SRTP (OpenSSL/LibreSSL/BoringSSL) • SRTP/SRTCP (libsrtp) • SCTP (usrsctplib) • Some other dependencies MAY need fuzzing (but not in Janus?) • Transports (HTTP, WebSockets, RabbitMQ, etc.) • JSON support (Jansson) • Custom code DEFINITELY needs fuzzing • RTCP parsing (e.g., compound packets) • RTP processing (e.g., RTP extensions, codec specific payloads) • SDP parsing and processing
  • 21. A quick intro to libFuzzer • Popular coverage-guided fuzzing engine, part of the LLVM project • https://llvm.org/docs/LibFuzzer.html • Used by several well known applications • glibc, OpenSSL/LibreSSL/BoringSSL, SQLite, FFmpeg and many more • A few key characteristics • Needs sources to be compiled with Clang • Works in-process (linked with the library/application under test) • Feeds inputs to the target via a fuzzing entrypoint (target function) • Execution of the target function is monitored with sanitizers tools (e.g., libasan)
  • 22. A quick intro to libFuzzer • Popular coverage-guided fuzzing engine, part of the LLVM project • https://llvm.org/docs/LibFuzzer.html • Used by several well known applications • glibc, OpenSSL/LibreSSL/BoringSSL, SQLite, FFmpeg and many more • A few key characteristics • Needs sources to be compiled with Clang • Works in-process (linked with the library/application under test) • Feeds inputs to the target via a fuzzing entrypoint (target function) • Execution of the target function is monitored with sanitizers tools (e.g., libasan)
  • 23. A quick intro to libFuzzer • Popular coverage-guided fuzzing engine, part of the LLVM project • https://llvm.org/docs/LibFuzzer.html • Used by several well known applications • glibc, OpenSSL/LibreSSL/BoringSSL, SQLite, FFmpeg and many more • A few key characteristics • Needs sources to be compiled with Clang • Works in-process (linked with the library/application under test) • Feeds inputs to the target via a fuzzing entrypoint (target function) • Execution of the target function is monitored with sanitizers tools (e.g., libasan)
  • 25. libFuzzer in (simplified) practice 1 Implement the method to receive and process the input data // my_fuzzer.c int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { ProcessData(Data, Size); return 0; } 2 Compile with Clang and the right flags > clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c 3 Launch passing the Corpus folder as the argument > ./my_fuzzer CORPUS_DIR 4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions) > gdb --args ./my_fuzzer crash-file-dump
  • 26. libFuzzer in (simplified) practice 1 Implement the method to receive and process the input data // my_fuzzer.c int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { ProcessData(Data, Size); return 0; } 2 Compile with Clang and the right flags > clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c 3 Launch passing the Corpus folder as the argument > ./my_fuzzer CORPUS_DIR 4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions) > gdb --args ./my_fuzzer crash-file-dump
  • 27. libFuzzer in (simplified) practice 1 Implement the method to receive and process the input data // my_fuzzer.c int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { ProcessData(Data, Size); return 0; } 2 Compile with Clang and the right flags > clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c 3 Launch passing the Corpus folder as the argument > ./my_fuzzer CORPUS_DIR 4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions) > gdb --args ./my_fuzzer crash-file-dump
  • 28. libFuzzer in (simplified) practice 1 Implement the method to receive and process the input data // my_fuzzer.c int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { ProcessData(Data, Size); return 0; } 2 Compile with Clang and the right flags > clang -g -O1 -fsanitize=fuzzer,address,undefined my_fuzzer.c 3 Launch passing the Corpus folder as the argument > ./my_fuzzer CORPUS_DIR 4 In case of crashes, pass the dumped input (e.g., via gdb, or to test regressions) > gdb --args ./my_fuzzer crash-file-dump
  • 29. Integrating libFuzzer in Janus • First step was Clang support (Janus normally built with gcc) • Streamlined compilation flags in the process • Got useful warnings that led to some fixes too • Next step was choosing what to fuzz • Decided to start with RTCP • Compound packets + length values + overflows = “fun”... • Then worked on the libFuzzer workflow 1 Fuzzing target with critical RTCP-related functions 2 Helper script to build the fuzzer 3 Helper script to run the fuzzer Original pull request (now merged, with RTP and SDP fuzzing as well) https://github.com/meetecho/janus-gateway/pull/1492
  • 30. Integrating libFuzzer in Janus • First step was Clang support (Janus normally built with gcc) • Streamlined compilation flags in the process • Got useful warnings that led to some fixes too • Next step was choosing what to fuzz • Decided to start with RTCP • Compound packets + length values + overflows = “fun”... • Then worked on the libFuzzer workflow 1 Fuzzing target with critical RTCP-related functions 2 Helper script to build the fuzzer 3 Helper script to run the fuzzer Original pull request (now merged, with RTP and SDP fuzzing as well) https://github.com/meetecho/janus-gateway/pull/1492
  • 31. Integrating libFuzzer in Janus • First step was Clang support (Janus normally built with gcc) • Streamlined compilation flags in the process • Got useful warnings that led to some fixes too • Next step was choosing what to fuzz • Decided to start with RTCP • Compound packets + length values + overflows = “fun”... • Then worked on the libFuzzer workflow 1 Fuzzing target with critical RTCP-related functions 2 Helper script to build the fuzzer 3 Helper script to run the fuzzer Original pull request (now merged, with RTP and SDP fuzzing as well) https://github.com/meetecho/janus-gateway/pull/1492
  • 32. Integrating libFuzzer in Janus • First step was Clang support (Janus normally built with gcc) • Streamlined compilation flags in the process • Got useful warnings that led to some fixes too • Next step was choosing what to fuzz • Decided to start with RTCP • Compound packets + length values + overflows = “fun”... • Then worked on the libFuzzer workflow 1 Fuzzing target with critical RTCP-related functions 2 Helper script to build the fuzzer 3 Helper script to run the fuzzer Original pull request (now merged, with RTP and SDP fuzzing as well) https://github.com/meetecho/janus-gateway/pull/1492
  • 33. Integrating libFuzzer in Janus // fuzz-rtcp.c #include "janus/rtcp.h" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (size < 8 || size > 1472) return 0; if (!janus_is_rtcp(data, size)) return 0; /* Initialize an empty RTCP context */ janus_rtcp_context ctx; janus_rtcp_parse(ctx, (char *)data, size); GSList *list = janus_rtcp_get_nacks((char *)data, size); ... if (list) g_slist_free(list); return 0; }
  • 35. Corpora files: a shared effort https://github.com/RTC-Cartel/webrtc-fuzzer-corpora
  • 36. Scalable distributed fuzzing via OSS-Fuzz https://github.com/google/oss-fuzz/pull/2241 (Janus addition)
  • 37. Scalable distributed fuzzing via OSS-Fuzz https://github.com/google/oss-fuzz/pull/2241 (Janus addition)
  • 38. A detailed tutorial on how to setup all this https://webrtchacks.com/fuzzing-janus/
  • 39. What’s next? • So far, we only fuzzed RTP, RTCP and in part SDP in the core • SDP fuzzing should be improved (maybe with structure-aware fuzzing?) • What about plugins and their custom interactions? • Definitely expand the corpora • The shared RTC-Cartel repo should help with that • Exchanging crash causes with other projects will make both more robust • libFuzzer is not the only option here • Some popular alternatives are AFL, Radamsa, Gasoline, etc. • KITE and its “weaponised” browsers can be very helpful as an orthogonal testing tool
  • 40. What’s next? • So far, we only fuzzed RTP, RTCP and in part SDP in the core • SDP fuzzing should be improved (maybe with structure-aware fuzzing?) • What about plugins and their custom interactions? • Definitely expand the corpora • The shared RTC-Cartel repo should help with that • Exchanging crash causes with other projects will make both more robust • libFuzzer is not the only option here • Some popular alternatives are AFL, Radamsa, Gasoline, etc. • KITE and its “weaponised” browsers can be very helpful as an orthogonal testing tool
  • 41. What’s next? • So far, we only fuzzed RTP, RTCP and in part SDP in the core • SDP fuzzing should be improved (maybe with structure-aware fuzzing?) • What about plugins and their custom interactions? • Definitely expand the corpora • The shared RTC-Cartel repo should help with that • Exchanging crash causes with other projects will make both more robust • libFuzzer is not the only option here • Some popular alternatives are AFL, Radamsa, Gasoline, etc. • KITE and its “weaponised” browsers can be very helpful as an orthogonal testing tool
  • 42. Thanks! Questions? Comments? Get in touch! • https://twitter.com/elminiero • https://twitter.com/meetecho • https://www.meetecho.com