Pentesting SIP
Session Initiation Protocol (SIP) is a signalling protocol commonly used for Voice over IP (VoIP) communications, responsible for establishing, modifying and terminating communication sessions. SIP services are often exposed by PBXs, VoIP gateways, call management systems or individual phones, and can be abused to enumerate extensions, test authentication and disclose internal network information.
Overview
Session Initiation Protocol (SIP) is a signalling protocol commonly used for Voice over IP (VoIP) communications. SIP is responsible for establishing, modifying and terminating communication sessions, while the actual voice traffic is normally carried separately using protocols such as RTP.
During an infrastructure penetration test we may discover SIP services exposed by PBXs, VoIP gateways, call management systems or individual phones.
SIP commonly uses:
5060 SIP over UDP/TCP5061 SIP over TLSPort 5060 shouldn’t be treated as the only place SIP can exist. VoIP systems can be configured to listen on different ports, and we may encounter multiple SIP services within the same environment.
Once a SIP service has been identified, we want to determine what it is, which SIP methods it supports, whether users or extensions can be enumerated, how authentication is configured and what information the service exposes.
Identifying SIP
The first step is normally confirming that the discovered service is actually SIP.
Nmap service detection can provide a quick starting point. You can find a comprehensive Nmap cheat sheet here.
nmap -sU -sV -p 5060 <target>Because SIP can use both UDP and TCP, it is worth checking both transports where appropriate:
nmap -sU -sS -p 5060,5061 <target>A SIP response may expose useful information in headers such as:
ServerUser-AgentAllowContactViaFromToCall-IDDepending on the implementation, these may reveal the PBX or SIP software in use, internal hostnames, IP addresses or supported functionality.
That information can then be used to guide the rest of the assessment.
SIP Methods
SIP works using request methods in a similar way to how HTTP has methods such as GET and POST.
Common SIP methods include:
OPTIONSREGISTERINVITEACKBYECANCELSUBSCRIBENOTIFYMESSAGEINFOWe don’t necessarily expect every SIP server to support every method.
For example, REGISTER is used by SIP clients to register their current location with a registrar, while INVITE is used to initiate a session.
OPTIONS is particularly useful during reconnaissance because it can be used to query the capabilities of a SIP endpoint without attempting to establish a call.
SIPVicious
SIPVicious is a collection of tools designed for auditing SIP-based VoIP systems and can be found here https://github.com/enablesecurity/sipvicious.
The suite contains several useful utilities:
sipvicious_svmap --helpsipvicious_svcrack --helpsipvicious_svcrash --helpsipvicious_svwar --helpsipvicious_svreport --helpThese tools perform different parts of the SIP assessment rather than being a single general-purpose scanner.
A rough breakdown is:
svmap Discover SIP devicessvwar Enumerate SIP extensionssvcrack Audit SIP authenticationsvreport Manage/report SIPVicious resultssvcrash Respond to certain scans from older SIPVicious clientsFor normal penetration testing, svmap, svwar and svcrack are generally the ones we’re most interested in.
Discovering SIP Devices with svmap
svmap can be used to identify SIP services within an address range.
For example:
sipvicious_svmap -p5060-5062 <target> -m OPTIONSHere we are scanning ports 5060 through 5062 and sending an OPTIONS request to identify responsive SIP services.
A network range can also be assessed:
sipvicious_svmap 192.168.1.0/24If we already know the target SIP port:
sipvicious_svmap -p5060 192.168.1.0/24The objective isn’t simply to find port 5060 open. We want to identify which systems actually respond as SIP devices and what information those responses provide.
In a VoIP network we may identify:
PBXSIP ProxySIP RegistrarVoIP GatewayIP PhonesSoftphonesEach can expose a different attack surface.
Nmap SIP Enumeration
Nmap also includes SIP-specific NSE scripts.
One useful starting point is identifying the methods supported by the server:
nmap -sU -p 5060 --script sip-methods <target>The returned methods can provide a better idea of the functionality exposed by the SIP service.
This is useful alongside SIPVicious because it gives us another way of confirming and interrogating the service rather than relying on a single tool.
Extension Enumeration
Once a SIP server has been identified, one of the more interesting questions is whether valid SIP users or extensions can be enumerated.
A VoIP environment may contain extensions such as:
100101102200120022003These extensions effectively identify SIP accounts and can provide targets for further authorised authentication testing.
SIPVicious svwar can be used for extension enumeration.
Start by reviewing the available options:
sipvicious_svwar --helpThe exact enumeration method and range should be selected according to the target system and engagement scope.
Nmap also provides sip-enum-users:
nmap -sU -p 5060 --script sip-enum-users <target>By default the script tests extensions from 0 through 999.
We can specify a more appropriate range:
nmap -sU -p 5060 \--script sip-enum-users \--script-args 'sip-enum-users.minext=1000,sip-enum-users.maxext=9999' \<target>This can be particularly useful when the organisation follows a predictable extension numbering scheme.
Understanding SIP Responses
SIP response codes can reveal whether an extension exists.
Responses may include:
200 Request succeeded401 Authentication required403 Request understood but forbidden404 User/resource not found407 Proxy authentication requiredThe important part is not simply memorising these status codes.
We’re looking for differences in behaviour between valid and invalid extensions.
For example, if:
Extension 1234 → 401 UnauthorizedExtension 8372 → 404 Not Foundthe server may be giving us enough information to distinguish valid extensions from invalid ones.
That becomes an account enumeration issue.
Nmap’s sip-enum-users performs this type of comparison automatically and even begins by testing a random extension to help identify false positives.
Authentication Testing
Once valid SIP extensions have been identified, the next question is how those accounts authenticate.
SIP commonly uses digest authentication rather than transmitting the password directly.
SIPVicious includes svcrack for authorised password auditing:
sipvicious_svcrack --helpAuthentication testing should be performed carefully.
VoIP systems may have account lockout controls, rate limiting or monitoring in place, and a large authentication attack can generate considerable noise.
Rather than immediately throwing a huge password list at every extension, first determine:
- Which extensions are valid?
- Is authentication actually required?
- Are lockouts configured?
- Is rate limiting present?
- Are default or predictable credentials likely?
- Does the engagement permit password guessing?
If password auditing is appropriate, use a controlled password list and rate.
Nmap SIP Authentication Testing
Nmap also includes a sip-brute NSE script for SIP password auditing.
Before using it, remember that this is an intrusive test and should only be performed when password auditing is within scope.
Enumeration and authentication testing are separate stages.
Knowing that extension 1234 exists does not automatically justify attempting thousands of passwords against it.
SIP over TLS
SIP may also be protected using TLS, commonly on TCP/5061.
If port 5061 is exposed, inspect the TLS service as well:
nmap -sV -p 5061 <target>The certificate itself may provide additional reconnaissance information such as:
HostnamesInternal domain namesOrganisation namesCertificate authorityAdditional Subject Alternative NamesTLS protects SIP signalling while it is in transit, but it doesn’t automatically mean the overall VoIP implementation is secure.
Authentication, extension enumeration and access-control issues may still exist above the transport layer.
Information Disclosure
SIP responses can sometimes disclose much more information than expected.
While reviewing responses, look for:
Internal IP addressesInternal hostnamesSIP domainsSoftware namesSoftware versionsExtension numbersUsernamesPBX identifiersNetwork topology informationFor example, Via, Contact and routing-related headers may expose addressing information that wasn’t previously known.
This becomes particularly useful during an external assessment where a publicly exposed SIP gateway may unintentionally reveal information about the internal VoIP environment.
UDP and TCP
Don’t assume that testing UDP/5060 is enough.
SIP supports both UDP and TCP, and a target may behave differently depending on the transport being used.
If SIP has been identified, check:
nmap -sU -p 5060 <target>as well as:
nmap -sT -p 5060 <target>TLS SIP can then be investigated separately on TCP/5061.
This is especially important where an initial port scan only performed TCP scanning, as UDP SIP services can otherwise be missed completely.
SIP Exploitation with Metasploit
Once the SIP service and underlying product have been identified, it is worth checking whether the platform has any known vulnerabilities or relevant Metasploit modules.
Metasploit contains a number of SIP and VoIP-related auxiliary modules. Start by searching the installed framework:
msfconsolesearch sipYou can narrow the search down further:
search type:auxiliary sipsearch type:exploit sipsearch cisco sipsearch asterisksearch freepbxDon’t search only for sip. Once we have fingerprinted the actual PBX, phone or gateway, searching for the vendor and product name will often produce more useful results.
SIP Extension Enumeration
Metasploit can also be used to enumerate SIP extensions:
use auxiliary/scanner/sip/enumeratorshow optionsset RHOSTS <target>set RPORT 5060runThis can provide another way of identifying valid extensions where the SIP server responds differently for existing and nonexistent users.
SIP OPTIONS Enumeration
The SIP OPTIONS method can be useful for identifying how a server responds and what functionality it advertises.
Metasploit modules vary between versions, so search the installed framework:
search sipThen inspect anything relevant with:
info <module>use <module>show optionsThis is preferable to blindly copying module names from old write-ups because SIP modules can be added, renamed or removed between Metasploit versions.
Product-Specific Exploitation
SIP itself isn’t usually the thing we are trying to exploit. Once we have identified the underlying product, we should start looking at the PBX, SIP server, gateway or phone implementation.
For example, we may discover:
AsteriskFreePBXCisco Unified Communications3CXAvayaGrandstreamYealinkMitelKamailioOpenSIPSAt this point, search Metasploit for the identified technology:
search asterisksearch freepbxsearch ciscosearch 3cxsearch avayaWe should also take any disclosed version information and check it against known vulnerabilities.
For example:
SIP/2.0 200 OKServer: Asterisk PBX 13.xThis gives us something much more useful to investigate than simply knowing UDP/5060 is open.
Testing Default Credentials
VoIP infrastructure is also worth checking for default credentials, particularly where we have discovered a web management interface alongside SIP.
For example, if scanning reveals:
80/tcp HTTP443/tcp HTTPS5060/udp SIPdon’t treat these as unrelated services.
The HTTP interface may be the administrative interface for the same PBX, gateway or IP phone identified through SIP.
Check the exact product documentation for default credentials and test them where credential testing is within scope.
SIP INVITE Testing
INVITE requests can also reveal whether unauthenticated users are able to initiate calls or interact with extensions.
What Should We Look For?
Once SIP has been identified, some of the questions worth answering are:
- What SIP software or device is exposed?
- Which SIP methods are available?
- Can valid extensions be enumerated?
- Does the service respond differently for valid and invalid users?
- Is authentication required?
- Are default or weak credentials in use?
- Is password guessing rate limited?
- Are account lockouts configured?
- Is SIP exposed externally when it should only be internally accessible?
- Is signalling transmitted without TLS?
- Do SIP responses expose internal IP addresses or hostnames?
- Are software versions disclosed?
- Are unnecessary SIP methods available?
- Can unauthenticated users interact with functionality that should require authentication?
As with most services, simply finding SIP exposed isn’t automatically a vulnerability.
A properly configured SIP gateway obviously needs to speak SIP.
What matters is what the service allows an unauthenticated or low-privileged user to discover or perform.
SIP testing tends to become much easier once we stop thinking of TCP/UDP 5060 as simply another open port.
The useful information is in how the SIP server responds.
A few carefully selected OPTIONS and REGISTER requests can tell us far more about the environment than simply reporting that a SIP service is listening.




