Securing Asterisk: A practical approach

SECURING ASTERISK;A PRACTICAL APPROACH
	
   	
   	
   	
   	
  SUMAN	
  KUMAR	
  SAHA	
  
	
   	
   	
   	
   	
  Manager,	
  System	
  Administra6on	
  	
  	
  	
  	
   	
  
	
   	
   	
   	
   	
  Dhakacom	
  Limited	
  
	
   	
   	
   	
   	
  suman@dhakacom.com	
  
AGENDA
§  Typical Threats Overview
§  Call stealing
§  Compromising the server
§  How to Protect the PBX
§  SSH communication
§  Separating data & voice
§  HTTP communication
§  Passwords
§  etc.
TYPICAL THREATS
§  Stealing of calls via:
§  telephony
§  VoIP trunks
§  SIP
§  IAX2
§  Compromising the Linux server via SSH/HTTP
STEALING CALLS VIA TELEPHONY OR VOIP TRUNKS
§  Disable the option of uncontrolled trunk-to-
trunk calls
§  DISA (Direct Inward System Access)
§  use long passwords
STEALING CALLS VIA SIP / IAX2: STAGE 1
§  Find PBX IP address and port number
§  Suggested tools:
§  nmap (http://nmap.org/)
§  svmap (http://code.google.com/p/sipvicious)
$ ./svmap.py 192.168.0.1/24
| SIP Device | User Agent | Fingerprint |
--------------------------------------------------------------------------
| 192.168.0.61:5060 | Asterisk PBX 1.6.2.| Asterisk / Linksys/PAP2T-3.1.|
| 192.168.0.185:5060 | Yealink SIP-T28P 2.| AVM or Speedport |
| 192.168.0.124:5060 | Grandstream GXP2000| Grandstream phone |
| 192.168.2.4:5060 | Yealink SIP-T26P 6.| AVM or Speedport |
| 192.168.0.184:5060 | Yealink SIP-T22P 7.| AVM or Speedport |
| 192.168.0.134:5060 | YATE/2.2.0 | AVM or Speedport |
STEALING CALLS VIA SIP / IAX2: STAGE 1
If you come through NAT:
./svmap.py -p1000-5062 202.4.100.35
| SIP Device | User Agent | Fingerprint |
-----------------------------------------------------------------------------------
| 202.4.100.35:2762 | Grandstream HT487 1.1.0.42 DevId 000b82233939 | disabled |
| 202.4.100.35:3303 | Grandstream HT487 1.1.0.42 DevId 000b82233fa9 | disabled |
| 202.4.100.35:1069 | Grandstream HT487 1.1.0.42 DevId 000b82233fec | disabled |
| 202.4.100.35:1061 | Grandstream HT487 1.1.0.42 DevId 000b82233e14 | disabled |
STEALING CALLS VIA SIP / IAX2: STAGE 2
§  Find a PBX extension
§  svwar (http://code.google.com/p/sipvicious)
§  Attacker tries to differentiate between
existing/non-existent extensions
§  SIP response to a REGISTER/INVITE/OPTION
request analysis could be used for it
STEALING CALLS VIA SIP / IAX2: STAGE 2
[root@ippbx sipvicious-0.2.8]# ./svwar.py -e1001 202.4.96.18 –force
ERROR:TakeASip:Response: 'SIP/2.0 401 UnauthorizedrnVia: SIP/
2.0/UDP
202.4.96.20:5061;branch=z9hG4bK-3218676409;received=202.
4.96.20;rport=5061rnFrom: "1001"<sip:
1001@202.4.96.18>;tag=31303031013337333237353837333
0rnTo: "1001"<sip:1001@202.4.96.18>;tag=as26840901r
nCall-ID: 677757433rnCSeq: 1 REGISTERrnServer: Asterisk
PBX 1.8.10.1~dfsg-1ubuntu1rnAllow: INVITE, ACK, CANCEL,
OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISHr
nSupported: replaces, timerrnWWW-Authenticate: Digest
algorithm=MD5, realm="asterisk", nonce="03f9b484"rnContent-
Length: 0rnrn'
WARNING:root:found nothing
STEALING CALLS VIA SIP / IAX2: STAGE 3
§  Find the password
§  svcrak (http://code.google.com/p/sipvicious)
§  When PBX is attacked there are many warning
messages in the Asterisk log:
[Jun..
for
] NOTICE[30940]
'192.168.0.192'
chan_sip.c: Registration
- Wrong
password
from '"308" failed
[Jun..
for
] NOTICE[30940]
'192.168.0.192'
chan_sip.c: Registration
- Wrong
password
from '"308" failed
[Jun..
for
] NOTICE[30940]
'192.168.0.192'
chan_sip.c: Registration
- Wrong
password
from '"308" failed
[Jun.. ] NOTICE[30940] chan_sip.c: Registration from '"308" failed
for '192.168.0.192' - Wrong password
STEALING CALLS VIA SIP / IAX2: STAGE 3
./svcrack.py -u1001 9.9.9.9
WARNING:ASipOfRedWine:could not bind to :5060 - some
process might already be listening on this port. Listening on
port 5061 instead
| Extension | Password |
------------------------
| 1001 | 1001 |
STEALING CALLS VIA SIP / IAX2: STAGE 4
§  The PBX has been conquered
§  A malicious user has registered an extension
and makes calls for free
§  In many cases this will be discovered only
when the next telephone bill is received
COMPROMISING THE LINUX SERVER
§  An Asterisk server is a regular Linux machine
that can also be compromised
§  Malware (viruses, trojan horses etc) may
infiltrate via different Linux networking
services such as SSH or HTTP
HOW TO PROTECT THE PBX
§  There are countless methods to “harden” a
server against attack
§  Each method has its price
§  99% of attacks are “simple” attacks, and
there are simple means to prevent them
SSH COMMUNICATION
§  Use public/private key authentication instead of
password authentication
§  Create a user account and disable log in as 'root':
§  /etc/ssh/sshd_config
§  Then it will be possible to connect to the PBX as a
non-'root' user, and then become a “super-user”:
§  ssh john@my-pbx-ip -p 4245
§  su -
§PermitRootLogin no
§  or
§
PermitRootLogin without-password
SSH COMMUNICATION CONT’D
§  Restrict the source IP addresses that are
allowed to access the server
§  Don't use the default SSH port (22/tcp)
a.  arrange port forwarding on the NAT router
or
b.  change the listening port in the PBX SSH
server configuration:
•  /etc/ssh/sshd_config
•  #Port 22
•  Port 4245
SEPARATING DATA & VOIP NETWORKS
§  Some customers with higher security
requirements separate the VoIP network
from the data network
§  Dedicated cabling network not required;
VLAN technology may be used instead
§  Helps prevent company data servers from
direct access from potentially vulnerable
VoIP devices
HTTP COMMUNICATION
§  Don't expose the PBX Web server to the
Internet
§  Use SSH tunneling for the PBX Web-based
management interface
§  Windows users can create SSH tunnels very
easily using PuTTY
PASSWORDS
§  Don't use the default passwords
§  Don't use simple passwords
SECURE VOIP COMMUNICATION
§  Don't expose SIP and IAX2 ports unless
absolutely necessary
§  Use IP restriction for internal VoIP extensions
§  Allows use of weak passwords or no passwords
for the internal extensions
§  Use strong passwords for remote extensions
LAN-ONLY REGISTRATION FOR EXTENSION
#	
  vim	
  /etc/asterisk/sip.conf	
  
	
  
Deny=0.0.0.0/0.0.0.0	
  
Allow=192.168.0.0/24	
  
INTRUSION DETECTION OPTIONS
§  It is possible to use a network intrusion
detection system
§  Fail2Ban (http://www.fail2ban.org)
§  Scans the log files and updates firewall rules
to reject the IP address
§  Snort (http://www.snort.org)
§  Powerful network intrusion prevention and
detection system (IDS/IPS)
FAIL2BAN FEATURES
§  Log-based brute force blocker
§  Runs as daemon
§  unlike cron-based tools, no delay before taking action
§  can use iptables or TCP Wrappers (/etc/
hosts.deny)
§  can handle more than one service: sshd, apache,
SIP traffic etc.
§  can send e-mail notifications
§  can ban IPs either for a limited amount of time or
permanently
FAIL2BAN USAGE
[asterisk-iptables]
# if more than 4 attempts are made within 6 hours, ban for 24
hours
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
sendmail[name=ASTERISK, dest=suman@dhakacom.com,
sender=fail2ban@dhakacom.com]
logpath = /var/log/asterisk/messages
maxretry = 4
findtime = 21600
bantime = 86400
FAIL2BAN EMAIL ALERT
From:fail2ban@dhakacom.com
To:noc@dhakacom.com
Hi, The IP 195.154.33.3 has just been banned by
Fail2Ban after 61 attempts against ASTERISK.
Regards, Fail2Ban
SNORT FEATURES
§  Sniffer mode
§  Logger mode
§  NIDS mode
§  Can capture and analyze traffic for several
servers
§  Intrusion prevention mode
§  Extremely mature system; actively developed
since 1998
SNORT USAGE
Packet sniffer: Snort reads IP packets and
displays them on the console.
#./snort -vd
Packet Logger: Snort logs IP packets.
#./snort -dev -l /var/log/snort
Intrusion Detection System: Snort uses rule sets
to inspect IP packets. When an IP packet
matches the characteristics of a given rule,
Snort may take one or more actions.
SNORT NIDS MODE
To run Snort for intrusion detection and log all
packets relative to the 192.168.10.0 network,
use the command:
snort -d -h 192.168.10.0 -l -c snort.conf
SUMMARY
§  Types of threats
§  Call stealing
§  Intrusion
§  Best practices
§  Protecting the PBX
§  Detecting attacks quickly
THANK YOU
suman@dhakacom.com	
  
1 of 29

Recommended

EMEA Airheads- ArubaOS - High availability with AP Fast Failover by
EMEA Airheads- ArubaOS - High availability with AP Fast FailoverEMEA Airheads- ArubaOS - High availability with AP Fast Failover
EMEA Airheads- ArubaOS - High availability with AP Fast FailoverAruba, a Hewlett Packard Enterprise company
4K views34 slides
HBase Low Latency by
HBase Low LatencyHBase Low Latency
HBase Low LatencyDataWorks Summit
5.1K views38 slides
Keynote: Apache HBase at Yahoo! Scale by
Keynote: Apache HBase at Yahoo! ScaleKeynote: Apache HBase at Yahoo! Scale
Keynote: Apache HBase at Yahoo! ScaleHBaseCon
5.3K views24 slides
The First Mile – Edge and IoT Data Collection with Apache NiFi and MiNiFi by
The First Mile – Edge and IoT Data Collection with Apache NiFi and MiNiFiThe First Mile – Edge and IoT Data Collection with Apache NiFi and MiNiFi
The First Mile – Edge and IoT Data Collection with Apache NiFi and MiNiFiDataWorks Summit
2.8K views51 slides
Secured Internet Gateway for ISP with pfsense & FRR by
Secured Internet Gateway for ISP with pfsense & FRRSecured Internet Gateway for ISP with pfsense & FRR
Secured Internet Gateway for ISP with pfsense & FRRBangladesh Network Operators Group
563 views20 slides
Monitoring and Resiliency Testing our Apache Kafka Clusters at Goldman Sachs ... by
Monitoring and Resiliency Testing our Apache Kafka Clusters at Goldman Sachs ...Monitoring and Resiliency Testing our Apache Kafka Clusters at Goldman Sachs ...
Monitoring and Resiliency Testing our Apache Kafka Clusters at Goldman Sachs ...HostedbyConfluent
1.2K views22 slides

More Related Content

What's hot

EMEA Airheads- LACP and distributed LACP – ArubaOS Switch by
EMEA Airheads- LACP and distributed LACP – ArubaOS SwitchEMEA Airheads- LACP and distributed LACP – ArubaOS Switch
EMEA Airheads- LACP and distributed LACP – ArubaOS SwitchAruba, a Hewlett Packard Enterprise company
6.6K views60 slides
Linux Linux Traffic Control by
Linux Linux Traffic ControlLinux Linux Traffic Control
Linux Linux Traffic ControlSUSE Labs Taipei
3.5K views19 slides
Campus_Network_Design_with_ArubaOS-CX_-_Leading_Practices by
Campus_Network_Design_with_ArubaOS-CX_-_Leading_PracticesCampus_Network_Design_with_ArubaOS-CX_-_Leading_Practices
Campus_Network_Design_with_ArubaOS-CX_-_Leading_PracticesRoanVillalobos1
802 views83 slides
Fhrp notes by
Fhrp notesFhrp notes
Fhrp notesKrunal Shah
2.4K views17 slides
Hp next gen msr series routers technical training 21 jan15 by
Hp next gen msr series routers technical training 21 jan15Hp next gen msr series routers technical training 21 jan15
Hp next gen msr series routers technical training 21 jan15Alkornn Tanomjitvimol
7.2K views55 slides
Scylla Summit 2022: Scylla 5.0 New Features, Part 2 by
Scylla Summit 2022: Scylla 5.0 New Features, Part 2Scylla Summit 2022: Scylla 5.0 New Features, Part 2
Scylla Summit 2022: Scylla 5.0 New Features, Part 2ScyllaDB
562 views45 slides

What's hot(20)

Campus_Network_Design_with_ArubaOS-CX_-_Leading_Practices by RoanVillalobos1
Campus_Network_Design_with_ArubaOS-CX_-_Leading_PracticesCampus_Network_Design_with_ArubaOS-CX_-_Leading_Practices
Campus_Network_Design_with_ArubaOS-CX_-_Leading_Practices
RoanVillalobos1802 views
Hp next gen msr series routers technical training 21 jan15 by Alkornn Tanomjitvimol
Hp next gen msr series routers technical training 21 jan15Hp next gen msr series routers technical training 21 jan15
Hp next gen msr series routers technical training 21 jan15
Scylla Summit 2022: Scylla 5.0 New Features, Part 2 by ScyllaDB
Scylla Summit 2022: Scylla 5.0 New Features, Part 2Scylla Summit 2022: Scylla 5.0 New Features, Part 2
Scylla Summit 2022: Scylla 5.0 New Features, Part 2
ScyllaDB562 views
Nginx Reverse Proxy with Kafka.pptx by wonyong hwang
Nginx Reverse Proxy with Kafka.pptxNginx Reverse Proxy with Kafka.pptx
Nginx Reverse Proxy with Kafka.pptx
wonyong hwang484 views
Nxll26 bgp ii by Netwax Lab
Nxll26 bgp iiNxll26 bgp ii
Nxll26 bgp ii
Netwax Lab482 views
Presentation f5 – beyond load balancer by xKinAnx
Presentation   f5 – beyond load balancerPresentation   f5 – beyond load balancer
Presentation f5 – beyond load balancer
xKinAnx15.4K views
What is-twamp by Nir Cohen
What is-twampWhat is-twamp
What is-twamp
Nir Cohen19K views
Introduction to Apache ZooKeeper by Saurav Haloi
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
Saurav Haloi128.6K views
Multi-WAN on pfSense 2.3 - pfSense Hangout March 2016 by Netgate
Multi-WAN on pfSense 2.3 - pfSense Hangout March 2016Multi-WAN on pfSense 2.3 - pfSense Hangout March 2016
Multi-WAN on pfSense 2.3 - pfSense Hangout March 2016
Netgate3.8K views
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te... by InfluxData
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...
How to Introduce Telemetry Streaming (gNMI) in Your Network with SNMP with Te...
InfluxData679 views
Hadoop REST API Security with Apache Knox Gateway by DataWorks Summit
Hadoop REST API Security with Apache Knox GatewayHadoop REST API Security with Apache Knox Gateway
Hadoop REST API Security with Apache Knox Gateway
DataWorks Summit12.9K views
Cisco Live! :: Introduction to IOS XR for Enterprises and Service Providers by Bruno Teixeira
Cisco Live! :: Introduction to IOS XR for Enterprises and Service ProvidersCisco Live! :: Introduction to IOS XR for Enterprises and Service Providers
Cisco Live! :: Introduction to IOS XR for Enterprises and Service Providers
Bruno Teixeira4.4K views
EDNS0 Client-Subnet for DNS based CDNs by Matt Jansen by MyNOG
EDNS0 Client-Subnet for DNS based CDNs by Matt JansenEDNS0 Client-Subnet for DNS based CDNs by Matt Jansen
EDNS0 Client-Subnet for DNS based CDNs by Matt Jansen
MyNOG1.9K views
Apache NiFi SDLC Improvements by Bryan Bende
Apache NiFi SDLC ImprovementsApache NiFi SDLC Improvements
Apache NiFi SDLC Improvements
Bryan Bende2.3K views

Viewers also liked

bdNOG Conference Report by
bdNOG Conference Report bdNOG Conference Report
bdNOG Conference Report Bangladesh Network Operators Group
662 views17 slides
OpenStack Cloud Administration Through Live Demonstration by
OpenStack Cloud Administration Through Live DemonstrationOpenStack Cloud Administration Through Live Demonstration
OpenStack Cloud Administration Through Live DemonstrationBangladesh Network Operators Group
819 views45 slides
Community Tools to Fight Against DDoS by
Community Tools to Fight Against DDoS Community Tools to Fight Against DDoS
Community Tools to Fight Against DDoS Bangladesh Network Operators Group
1.2K views28 slides
RPKI Deployment Status in Bangladesh by
RPKI Deployment Status in Bangladesh RPKI Deployment Status in Bangladesh
RPKI Deployment Status in Bangladesh Bangladesh Network Operators Group
845 views35 slides
Cyber security Awareness: In perspective of Bangladesh by
Cyber security Awareness: In perspective of Bangladesh Cyber security Awareness: In perspective of Bangladesh
Cyber security Awareness: In perspective of Bangladesh Bangladesh Network Operators Group
4.2K views25 slides
IP Transit : Simple Math - Simple Calculation by
IP Transit : Simple Math - Simple CalculationIP Transit : Simple Math - Simple Calculation
IP Transit : Simple Math - Simple CalculationBangladesh Network Operators Group
2K views35 slides

Viewers also liked(20)

Similar to Securing Asterisk: A practical approach

Server hardening by
Server hardeningServer hardening
Server hardeningTeja Babu
1.4K views31 slides
Null bhopal Sep 2016: What it Takes to Secure a Web Application by
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationNull bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationAnant Shrivastava
4.1K views48 slides
Asterisksecuritykingasterisk 130723131448-phpapp01 by
Asterisksecuritykingasterisk 130723131448-phpapp01Asterisksecuritykingasterisk 130723131448-phpapp01
Asterisksecuritykingasterisk 130723131448-phpapp01King Astreisk Technologies
426 views81 slides
What Is IVR ? by
What Is IVR ?What Is IVR ?
What Is IVR ?King Astreisk Technologies
616 views81 slides
Securing Network Access with Open Source solutions by
Securing Network Access with Open Source solutionsSecuring Network Access with Open Source solutions
Securing Network Access with Open Source solutionsNick Owen
2.1K views46 slides
bh-us-02-murphey-freebsd by
bh-us-02-murphey-freebsdbh-us-02-murphey-freebsd
bh-us-02-murphey-freebsdwebuploader
611 views47 slides

Similar to Securing Asterisk: A practical approach(20)

Server hardening by Teja Babu
Server hardeningServer hardening
Server hardening
Teja Babu1.4K views
Null bhopal Sep 2016: What it Takes to Secure a Web Application by Anant Shrivastava
Null bhopal Sep 2016: What it Takes to Secure a Web ApplicationNull bhopal Sep 2016: What it Takes to Secure a Web Application
Null bhopal Sep 2016: What it Takes to Secure a Web Application
Anant Shrivastava4.1K views
Securing Network Access with Open Source solutions by Nick Owen
Securing Network Access with Open Source solutionsSecuring Network Access with Open Source solutions
Securing Network Access with Open Source solutions
Nick Owen2.1K views
bh-us-02-murphey-freebsd by webuploader
bh-us-02-murphey-freebsdbh-us-02-murphey-freebsd
bh-us-02-murphey-freebsd
webuploader611 views
Multi-Layer DDoS Mitigation Strategies by Sagi Brody
Multi-Layer DDoS Mitigation StrategiesMulti-Layer DDoS Mitigation Strategies
Multi-Layer DDoS Mitigation Strategies
Sagi Brody3.2K views
NAS Botnet Revealed - Mining Bitcoin by Davide Cioccia
NAS Botnet Revealed - Mining Bitcoin NAS Botnet Revealed - Mining Bitcoin
NAS Botnet Revealed - Mining Bitcoin
Davide Cioccia1.8K views
How to secure ubuntu 12.04 by John Richard
How to secure ubuntu 12.04 How to secure ubuntu 12.04
How to secure ubuntu 12.04
John Richard5.1K views
Scanning The Intertubes For Voip by Sandro Gauci
Scanning The Intertubes For VoipScanning The Intertubes For Voip
Scanning The Intertubes For Voip
Sandro Gauci872 views
Linux security quick reference guide by Craig Cannon
Linux security quick reference guideLinux security quick reference guide
Linux security quick reference guide
Craig Cannon887 views
Firewall arch by Tareq Hanaysha by Hanaysha
Firewall arch by Tareq HanayshaFirewall arch by Tareq Hanaysha
Firewall arch by Tareq Hanaysha
Hanaysha429 views
8 steps to protect your cisco router by IT Tech
8 steps to protect your cisco router8 steps to protect your cisco router
8 steps to protect your cisco router
IT Tech792 views

More from Bangladesh Network Operators Group

IPv6 Deployment in South Asia 2022 by
IPv6 Deployment in South Asia  2022IPv6 Deployment in South Asia  2022
IPv6 Deployment in South Asia 2022Bangladesh Network Operators Group
43 views20 slides
Introduction to Software Defined Networking (SDN) by
Introduction to Software Defined Networking (SDN)Introduction to Software Defined Networking (SDN)
Introduction to Software Defined Networking (SDN)Bangladesh Network Operators Group
143 views27 slides
RPKI Deployment Status in Bangladesh by
RPKI Deployment Status in BangladeshRPKI Deployment Status in Bangladesh
RPKI Deployment Status in BangladeshBangladesh Network Operators Group
45 views21 slides
An Overview about open UDP Services by
An Overview about open UDP ServicesAn Overview about open UDP Services
An Overview about open UDP ServicesBangladesh Network Operators Group
217 views15 slides
12 Years in DNS Security As a Defender by
12 Years in DNS Security As a Defender12 Years in DNS Security As a Defender
12 Years in DNS Security As a DefenderBangladesh Network Operators Group
111 views21 slides
Contents Localization Initiatives to get better User Experience by
Contents Localization Initiatives to get better User ExperienceContents Localization Initiatives to get better User Experience
Contents Localization Initiatives to get better User ExperienceBangladesh Network Operators Group
78 views31 slides

More from Bangladesh Network Operators Group(20)

Recently uploaded

ATPMOUSE_융합2조.pptx by
ATPMOUSE_융합2조.pptxATPMOUSE_융합2조.pptx
ATPMOUSE_융합2조.pptxkts120898
35 views70 slides
WITS Deck by
WITS DeckWITS Deck
WITS DeckW.I.T.S.
36 views22 slides
40th TWNIC Open Policy Meeting: A quick look at QUIC by
40th TWNIC Open Policy Meeting: A quick look at QUIC40th TWNIC Open Policy Meeting: A quick look at QUIC
40th TWNIC Open Policy Meeting: A quick look at QUICAPNIC
109 views20 slides
cis5-Project-11a-Harry Lai by
cis5-Project-11a-Harry Laicis5-Project-11a-Harry Lai
cis5-Project-11a-Harry Laiharrylai126
9 views11 slides
ARNAB12.pdf by
ARNAB12.pdfARNAB12.pdf
ARNAB12.pdfArnabChakraborty499766
5 views83 slides
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx by
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptxCracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptxLeasedLinesQuote
5 views8 slides

Recently uploaded(13)

ATPMOUSE_융합2조.pptx by kts120898
ATPMOUSE_융합2조.pptxATPMOUSE_융합2조.pptx
ATPMOUSE_융합2조.pptx
kts12089835 views
WITS Deck by W.I.T.S.
WITS DeckWITS Deck
WITS Deck
W.I.T.S.36 views
40th TWNIC Open Policy Meeting: A quick look at QUIC by APNIC
40th TWNIC Open Policy Meeting: A quick look at QUIC40th TWNIC Open Policy Meeting: A quick look at QUIC
40th TWNIC Open Policy Meeting: A quick look at QUIC
APNIC109 views
cis5-Project-11a-Harry Lai by harrylai126
cis5-Project-11a-Harry Laicis5-Project-11a-Harry Lai
cis5-Project-11a-Harry Lai
harrylai1269 views
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx by LeasedLinesQuote
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptxCracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
Penetration Testing for Cybersecurity Professionals by 211 Check
Penetration Testing for Cybersecurity ProfessionalsPenetration Testing for Cybersecurity Professionals
Penetration Testing for Cybersecurity Professionals
211 Check49 views
The Dark Web : Hidden Services by Anshu Singh
The Dark Web : Hidden ServicesThe Dark Web : Hidden Services
The Dark Web : Hidden Services
Anshu Singh22 views
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download by APNIC
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download
APNIC112 views
40th TWNIC Open Policy Meeting: APNIC PDP update by APNIC
40th TWNIC Open Policy Meeting: APNIC PDP update40th TWNIC Open Policy Meeting: APNIC PDP update
40th TWNIC Open Policy Meeting: APNIC PDP update
APNIC106 views

Securing Asterisk: A practical approach

  • 1. SECURING ASTERISK;A PRACTICAL APPROACH          SUMAN  KUMAR  SAHA            Manager,  System  Administra6on                      Dhakacom  Limited            suman@dhakacom.com  
  • 2. AGENDA §  Typical Threats Overview §  Call stealing §  Compromising the server §  How to Protect the PBX §  SSH communication §  Separating data & voice §  HTTP communication §  Passwords §  etc.
  • 3. TYPICAL THREATS §  Stealing of calls via: §  telephony §  VoIP trunks §  SIP §  IAX2 §  Compromising the Linux server via SSH/HTTP
  • 4. STEALING CALLS VIA TELEPHONY OR VOIP TRUNKS §  Disable the option of uncontrolled trunk-to- trunk calls §  DISA (Direct Inward System Access) §  use long passwords
  • 5. STEALING CALLS VIA SIP / IAX2: STAGE 1 §  Find PBX IP address and port number §  Suggested tools: §  nmap (http://nmap.org/) §  svmap (http://code.google.com/p/sipvicious) $ ./svmap.py 192.168.0.1/24 | SIP Device | User Agent | Fingerprint | -------------------------------------------------------------------------- | 192.168.0.61:5060 | Asterisk PBX 1.6.2.| Asterisk / Linksys/PAP2T-3.1.| | 192.168.0.185:5060 | Yealink SIP-T28P 2.| AVM or Speedport | | 192.168.0.124:5060 | Grandstream GXP2000| Grandstream phone | | 192.168.2.4:5060 | Yealink SIP-T26P 6.| AVM or Speedport | | 192.168.0.184:5060 | Yealink SIP-T22P 7.| AVM or Speedport | | 192.168.0.134:5060 | YATE/2.2.0 | AVM or Speedport |
  • 6. STEALING CALLS VIA SIP / IAX2: STAGE 1 If you come through NAT: ./svmap.py -p1000-5062 202.4.100.35 | SIP Device | User Agent | Fingerprint | ----------------------------------------------------------------------------------- | 202.4.100.35:2762 | Grandstream HT487 1.1.0.42 DevId 000b82233939 | disabled | | 202.4.100.35:3303 | Grandstream HT487 1.1.0.42 DevId 000b82233fa9 | disabled | | 202.4.100.35:1069 | Grandstream HT487 1.1.0.42 DevId 000b82233fec | disabled | | 202.4.100.35:1061 | Grandstream HT487 1.1.0.42 DevId 000b82233e14 | disabled |
  • 7. STEALING CALLS VIA SIP / IAX2: STAGE 2 §  Find a PBX extension §  svwar (http://code.google.com/p/sipvicious) §  Attacker tries to differentiate between existing/non-existent extensions §  SIP response to a REGISTER/INVITE/OPTION request analysis could be used for it
  • 8. STEALING CALLS VIA SIP / IAX2: STAGE 2 [root@ippbx sipvicious-0.2.8]# ./svwar.py -e1001 202.4.96.18 –force ERROR:TakeASip:Response: 'SIP/2.0 401 UnauthorizedrnVia: SIP/ 2.0/UDP 202.4.96.20:5061;branch=z9hG4bK-3218676409;received=202. 4.96.20;rport=5061rnFrom: "1001"<sip: 1001@202.4.96.18>;tag=31303031013337333237353837333 0rnTo: "1001"<sip:1001@202.4.96.18>;tag=as26840901r nCall-ID: 677757433rnCSeq: 1 REGISTERrnServer: Asterisk PBX 1.8.10.1~dfsg-1ubuntu1rnAllow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISHr nSupported: replaces, timerrnWWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="03f9b484"rnContent- Length: 0rnrn' WARNING:root:found nothing
  • 9. STEALING CALLS VIA SIP / IAX2: STAGE 3 §  Find the password §  svcrak (http://code.google.com/p/sipvicious) §  When PBX is attacked there are many warning messages in the Asterisk log: [Jun.. for ] NOTICE[30940] '192.168.0.192' chan_sip.c: Registration - Wrong password from '"308" failed [Jun.. for ] NOTICE[30940] '192.168.0.192' chan_sip.c: Registration - Wrong password from '"308" failed [Jun.. for ] NOTICE[30940] '192.168.0.192' chan_sip.c: Registration - Wrong password from '"308" failed [Jun.. ] NOTICE[30940] chan_sip.c: Registration from '"308" failed for '192.168.0.192' - Wrong password
  • 10. STEALING CALLS VIA SIP / IAX2: STAGE 3 ./svcrack.py -u1001 9.9.9.9 WARNING:ASipOfRedWine:could not bind to :5060 - some process might already be listening on this port. Listening on port 5061 instead | Extension | Password | ------------------------ | 1001 | 1001 |
  • 11. STEALING CALLS VIA SIP / IAX2: STAGE 4 §  The PBX has been conquered §  A malicious user has registered an extension and makes calls for free §  In many cases this will be discovered only when the next telephone bill is received
  • 12. COMPROMISING THE LINUX SERVER §  An Asterisk server is a regular Linux machine that can also be compromised §  Malware (viruses, trojan horses etc) may infiltrate via different Linux networking services such as SSH or HTTP
  • 13. HOW TO PROTECT THE PBX §  There are countless methods to “harden” a server against attack §  Each method has its price §  99% of attacks are “simple” attacks, and there are simple means to prevent them
  • 14. SSH COMMUNICATION §  Use public/private key authentication instead of password authentication §  Create a user account and disable log in as 'root': §  /etc/ssh/sshd_config §  Then it will be possible to connect to the PBX as a non-'root' user, and then become a “super-user”: §  ssh john@my-pbx-ip -p 4245 §  su - §PermitRootLogin no §  or § PermitRootLogin without-password
  • 15. SSH COMMUNICATION CONT’D §  Restrict the source IP addresses that are allowed to access the server §  Don't use the default SSH port (22/tcp) a.  arrange port forwarding on the NAT router or b.  change the listening port in the PBX SSH server configuration: •  /etc/ssh/sshd_config •  #Port 22 •  Port 4245
  • 16. SEPARATING DATA & VOIP NETWORKS §  Some customers with higher security requirements separate the VoIP network from the data network §  Dedicated cabling network not required; VLAN technology may be used instead §  Helps prevent company data servers from direct access from potentially vulnerable VoIP devices
  • 17. HTTP COMMUNICATION §  Don't expose the PBX Web server to the Internet §  Use SSH tunneling for the PBX Web-based management interface §  Windows users can create SSH tunnels very easily using PuTTY
  • 18. PASSWORDS §  Don't use the default passwords §  Don't use simple passwords
  • 19. SECURE VOIP COMMUNICATION §  Don't expose SIP and IAX2 ports unless absolutely necessary §  Use IP restriction for internal VoIP extensions §  Allows use of weak passwords or no passwords for the internal extensions §  Use strong passwords for remote extensions
  • 20. LAN-ONLY REGISTRATION FOR EXTENSION #  vim  /etc/asterisk/sip.conf     Deny=0.0.0.0/0.0.0.0   Allow=192.168.0.0/24  
  • 21. INTRUSION DETECTION OPTIONS §  It is possible to use a network intrusion detection system §  Fail2Ban (http://www.fail2ban.org) §  Scans the log files and updates firewall rules to reject the IP address §  Snort (http://www.snort.org) §  Powerful network intrusion prevention and detection system (IDS/IPS)
  • 22. FAIL2BAN FEATURES §  Log-based brute force blocker §  Runs as daemon §  unlike cron-based tools, no delay before taking action §  can use iptables or TCP Wrappers (/etc/ hosts.deny) §  can handle more than one service: sshd, apache, SIP traffic etc. §  can send e-mail notifications §  can ban IPs either for a limited amount of time or permanently
  • 23. FAIL2BAN USAGE [asterisk-iptables] # if more than 4 attempts are made within 6 hours, ban for 24 hours enabled = true filter = asterisk action = iptables-allports[name=ASTERISK, protocol=all] sendmail[name=ASTERISK, dest=suman@dhakacom.com, sender=fail2ban@dhakacom.com] logpath = /var/log/asterisk/messages maxretry = 4 findtime = 21600 bantime = 86400
  • 24. FAIL2BAN EMAIL ALERT From:fail2ban@dhakacom.com To:noc@dhakacom.com Hi, The IP 195.154.33.3 has just been banned by Fail2Ban after 61 attempts against ASTERISK. Regards, Fail2Ban
  • 25. SNORT FEATURES §  Sniffer mode §  Logger mode §  NIDS mode §  Can capture and analyze traffic for several servers §  Intrusion prevention mode §  Extremely mature system; actively developed since 1998
  • 26. SNORT USAGE Packet sniffer: Snort reads IP packets and displays them on the console. #./snort -vd Packet Logger: Snort logs IP packets. #./snort -dev -l /var/log/snort Intrusion Detection System: Snort uses rule sets to inspect IP packets. When an IP packet matches the characteristics of a given rule, Snort may take one or more actions.
  • 27. SNORT NIDS MODE To run Snort for intrusion detection and log all packets relative to the 192.168.10.0 network, use the command: snort -d -h 192.168.10.0 -l -c snort.conf
  • 28. SUMMARY §  Types of threats §  Call stealing §  Intrusion §  Best practices §  Protecting the PBX §  Detecting attacks quickly