[Asterisk-bsd] Securing Asterisk with a DID

Frank Griffith glassdude45 at yahoo.com
Mon Aug 30 06:34:15 CDT 2010


At the suggestion of my VOIP provider I enabled full logging. There were at 
least two attempts during the night to make calls again from my server. It does 
now appear they are getting into my asterisk server but I cannot understand how. 
Someone suggested a "forked IP" whatever the hell that means....

Here are the entries from my full log file:

[Aug 29 23:11:51] NOTICE[92568] chan_sip.c: Registration from 
'"94.23.222.75:5060.....85.31.178.110.....203.174.41.18....190.10.27.80"<sip:100 at 98.242.233.74>'
 failed for '188.161.221.100' - No matching peer found
[Aug 30 00:37:40] NOTICE[92568] chan_sip.c: Registration from '85.43.196.74 ... 
87.236.186.110...202.43.190.195..202.43.190.195..203.215.155.38<sip:100 at 98.242.233.74>'
 failed for '109.253.85.228' - No matching peer found
[Aug 30 00:37:40] NOTICE[92568] chan_sip.c: Registration from '85.43.196.74 ... 
87.236.186.110...202.43.190.195..202.43.190.195..203.215.155.38<sip:100 at 98.242.233.74>'
 failed for '109.253.85.228' - No matching peer found
[Aug 30 00:37:55] VERBOSE[92568] logger.c:     -- Executing 
[011972599544327 at default:1] Set("SIP/98.242.233.74-00000004", 
"CALLERID(all)=3058291080") in new stack
[Aug 30 00:37:55] VERBOSE[92568] logger.c:     -- Executing 
[011972599544327 at default:2] Dial("SIP/98.242.233.74-00000004", 
"SIP/my_voip_provider/011972599544327,,wWFotThH") in new stack
[Aug 30 00:37:55] VERBOSE[92568] logger.c:     -- Called 
my_voip_provider/011972599544327
[Aug 30 00:37:56] VERBOSE[92568] logger.c:     -- SIP/my_voip_provider-00000005 
is making progress passing it to SIP/98.242.233.74-00000004
[Aug 30 00:37:58] VERBOSE[92568] logger.c:     -- Got SIP response 402 "Zero 
balance" back from 204.74.213.5
[Aug 30 00:37:58] VERBOSE[92568] logger.c:     -- No one is available to answer 
at this time (1:0/0/0)
[Aug 30 00:37:58] VERBOSE[92568] logger.c:     -- Executing 
[011972599544327 at default:3] PlayTones("SIP/98.242.233.74-00000004", 
"congestion") in new stack
[Aug 30 00:37:58] VERBOSE[92568] logger.c:     -- Executing 
[011972599544327 at default:4] Hangup("SIP/98.242.233.74-00000004", "") in new 
stack
[Aug 30 00:37:58] VERBOSE[92568] logger.c:   == Spawn extension (default, 
011972599544327, 4) exited non-zero on 'SIP/98.242.233.74-00000004'
[Aug 30 00:38:00] NOTICE[92568] chan_sip.c: Registration from '85.43.196.74 ... 
87.236.186.110...202.43.190.195..202.43.190.195..203.215.155.38<sip:100 at 98.242.233.74>'
 failed for '109.253.85.228' - No matching peer found

OK so I see the attempts to register but they fail. Still somehow the call get 
attempted. The only thing keeping them from going through now is the fact that 
my VOIP account has a zero balance. Can anyone shed some light on what exactly 
is happening here. As I see it now there is a major security hole in asterisk.





________________________________
From: Frank Griffith <glassdude45 at yahoo.com>
To: Asterisk on BSD discussion <asterisk-bsd at lists.digium.com>
Sent: Mon, August 30, 2010 5:31:52 AM
Subject: Re: [Asterisk-bsd] Securing Asterisk with a DID


Once again thanks for the advice. I am too much of a noob to understand what's 
happening here. This is an entry from the log file from this morning. The 
thieves tried again to use my server but since my provider as no credit on my 
account they are being rejected. Okay that's cool but now it appears that they 
are getting in through my asterisk server not through the DID #. Note I have 
"x"ed out the information I need to remain private in this entry. The IP address 
100.100.100.100 is actually my IP address from Comcast.

"","xxxxxxxxxx","011972599544327","default","xxxxxxxxxx","SIP/100.100.100.100-00000004","SIP/my_voip_provider-00000005","Hangup","","2010-08-30
 04:37:55",,"2010-08-30 04:37:58",3,0,"NO 
ANSWER","DOCUMENTATION","1283143075.4",""
 
Some of the log file entires show other outside IP addresses instead of my 
router's IP address. A couple of them actually show 127.0.0.1 which leads me to 
believe they have gotten access to my asterisk server. This boggle my mind 
because without the username and password how would asterisk allow them to make 
calls. I understand how they could do this using the DID because my dialplan was 
weak. But it now appears they did not use the DID # instead they hacked in 
through some method.




________________________________
From: Tim St. Pierre <tim at communicatefreely.net>
To: Asterisk on BSD discussion <asterisk-bsd at lists.digium.com>
Sent: Sun, August 29, 2010 11:37:38 PM
Subject: Re: [Asterisk-bsd] Securing Asterisk with a DID

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The IP address should tell you a lot.

If the IP address that the calls come from does not belong to your DID provider, 
then the call
didn't come in on your DID.

Some things you may want to look at -

In your sip.conf, before you declare any peers, what context are you pointing 
"anonymous" calls to?

If it still says default, anything in your default context is accessible to 
anyone from anywhere.

An easy way to fix this is to change it to something like "public", then create 
a public context
that only allows calls to extensions, or other places you want the public at 
large to be able to access.

Good luck!

- -Tim

Frank Griffith wrote:
> Thanks. I'm still a novice at hardening my asterisk system. I never had
> any trouble until recently. I think someone found my DID number and
> that's what the source of the hack is, not actually through my asterisk
> server. But the VOIP provider is convinced that's how it happened. But
> wouldn't the /var/log/asterisk/cdr-cvs/Master.csv file show which
> extension they used. And I'm not seeing any of the illegal calls being
> logged with an extension in my asterisk sip.conf file. They are logged
> with an IP address...which again I don't know how to interpret other
> than running a whois and seeing that alot of them originate from Amsterdam.
>  
>  
> ------------------------------------------------------------------------
> *From:* Tim St. Pierre <tim at communicatefreely.net>
> *To:* Asterisk on BSD discussion <asterisk-bsd at lists.digium.com>
> *Sent:* Sun, August 29, 2010 9:07:07 PM
> *Subject:* Re: [Asterisk-bsd] Securing Asterisk with a DID
> 
> You mean, you didn't before?
> 
> I wouldn't really call them a terrorist if there was nothing stopping
> them from dialing through your
> system.  Oppertunist, unscrupulous perhaps.  Terrorists generally try to
> cause mass destruction or
> panic in a large group of people.
> 
> At any rate, it isn't hard.
> 
> You could use vm_authenticate, which will authenticate based on the
> voice mail password, or just
> plain authenticate.
> 
> You should also do some pattern matching on the numbers that are input,
> before the call is sent back
> out.  Do you really need to call anywhere in the world, or just certain
> places?  You could restrict
> the destinations, which might save you if someone figures your password out.
> 
> -Tim
> 
> Frank Griffith wrote:
>> I have a DID with a VOIP provider which has worked pretty well. Until
>> some terrorist of some one of similar liking discovered it and used up
>> all my credits calling Israel, Morroco and Cuba. I would like to find
>> out how to be able to setup this DID so that only I could call into it
>> and access my service for making outside calls. I could disable this all
>> together but then that defeats my reason for needing the DID in the
>> first place. Is there a way to perhaps password protect this, that is
>> when I call in I have to enter a password before being allowed to dial
> out?
> 
> 
> 

- --
_____________________________________________________________________
- -- Bandwidth and Colocation Provided by http://www.api-digital.com --

Asterisk-BSD mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-bsd


- --
Tim St. Pierre
IP Voice technician
Communicate Freely
1-877-291-8647 x5101
sip:5101 at communicatefreely.net
tim at communicatefreely.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iJwEAQECAAYFAkx7J4IACgkQipVy80Kcc6sDDgQAg7KB5Ngbr5H7gB5LOPGCH+lh
1kzD+XCcoZcq4W8SY6uCTpVi5Jdua6DI8pdWMRRrkkMOPpbyp8/dgIBZuIFMQ+th
04/8W3K8gwWyiljLy1qCmFdklJO1g4LZYsXVqY4jsmWor2rEs17l1WnYUJnFEH+v
gmD6ROuwkUCqUBM0dM4=
=S16L
-----END PGP SIGNATURE-----

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Asterisk-BSD mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-bsd


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-bsd/attachments/20100830/8673a3ab/attachment-0001.htm 


More information about the Asterisk-BSD mailing list