Security: How to get your trixbox hacked in no time.

obeliks
Posts: 878
Member Since:
2010-03-14

Here is the list (incomplete) of ways your trixbox can be hacked. Given most of the people use default passwords, exploiting most of these is trivial.
It is also amazing fonality continues to distribute the product with so many security holes enabled.

1. UDP port 5060.

Opening this port may allow internet users to place calls through your box.
You should almost never open this port.

2. TCP port 5038

This allows remote access to the manager interface ( read: full access to your asterisk instance, call origination, etc .... )

3. TCP/UDP port 11211

Access to memcached allows stealing your session credentials and login as maint user if access to your web interface is allowed.
Given the fact this port falls in the range of the default RTP ports (10000-20000) most users will have it enabled.
Memcached SHOULD NOT be used on trixbox.

4. TCP port 3306

This is the mysql port. You can modify the content of the database, read extensions/user credentials, create custom extensions, etc ....

5. TCP port 4445

FOP server - call management, etc ...

6. Port 80 and 443
Access to the admin web interface.

Additional info:

http://fonality.com/trixbox/forums/trixbox-forums/open-discussion...
http://fonality.com/trixbox/forums/trixbox-forums/open-discussion...
http://fonality.com/trixbox/forums/trixbox-forums/open-discussion...
http://fonality.com/trixbox/forums/trixbox-forums/open-discussion...
http://fonality.com/trixbox/forums/trixbox-forums/open-discussion...



jades
Posts: 2340
Member Since:
2006-11-26
Thanks Read here

Thanks
Read here too
http://nerdvittles.com/index.php?p=580
http://www.foxnews.com/story/0,2933,471105,00.html?sPage=fnc/scit...

--

Joseph Ades
josephades1_at_gmail_dot_com
(212) 937-4299



andrew
Posts: 1472
Member Since:
2006-05-30
Thanks for this update.

Thanks for this update. Fortunately most of these are locked down by default.

1. This is very important. Make sure you are using strong SIP passwords if you open this port. You should also limit the RTP ports used by Asterisk if you allow external access. There is lot's of info on voip-info.org on how to do this.

2. The manager interface is disabled for external access by default. If you enable it for external access by editing manager.conf make sure you limit you acccess to a set IP range.

3. Fortunately although there is a bug in memcached trixbox does not use the version with the bug that exposes information. Still if you have open access to your trixbox limit the port range as stated in part 1 to below port 11000 this will cut off external access to memcached. We are evaluatiting if memcached should be used on trixbox at all.

4. this port is locked from external access by default

5. this port is locked from external access by default

6. there is a password on the crucial data on the web interface. make sure to change this password and don't open this port unless you have too.

obeliks, seems like you know quite a bit about security. Please feel free to add a section to the wiki on how to secure your trixbox. We can add other information like this there. That section in your last linked post about how to move the rtp ports Asterisk uses is particularly useful.



ciscostudent561
Posts: 31
Member Since:
2009-04-18
great stuff thanks

great stuff thanks



obeliks
Posts: 878
Member Since:
2010-03-14
I am sorry but stating

I am sorry but stating bluntly an incorrect information does not make it true.
I might start to think you never installed 2.8.0.4 yourself.

Here is the list of open ports on 2.8.0.4 right after install, the list does not include ssh, http, ftp and ntp.

There are 18 ports wide open, including 8 ports opened by asterisk. Anybody can send packets to them.
For example, sending garbage to the manager port causes asterisk to start eating 100% CPU and dropping packets and registrations.

             COMMAND         USER  PORT
     1        xinetd         root UDP 69
     2       portmap          rpc TCP 111
     3       portmap          rpc UDP 111
     4     rpc.statd         root UDP 631
     5     rpc.statd         root UDP 634
     6     rpc.statd         root TCP 637
     7      asterisk     asterisk TCP 1720
     8      asterisk     asterisk TCP 2000
     9      asterisk     asterisk UDP 2727
    10        mysqld        mysql TCP 3306
    11     op_server     asterisk TCP 4445
    12      asterisk     asterisk UDP 4520
    13      asterisk     asterisk UDP 4569
    14      asterisk     asterisk UDP 5000
    15      asterisk     asterisk TCP 5038
    16      asterisk     asterisk UDP 5060
    17     memcached       nobody TCP 11211
    18     memcached       nobody UDP 11211


rrichiez
Posts: 567
Member Since:
2006-12-07
Okay my question

It might be stupid of me to ask... but im confused If you don't open udp 5060 in the router you cant get sip out? Am i getting this wrong? is there a manual to go by?

thanks
rrichiez



obeliks
Posts: 878
Member Since:
2010-03-14
rrichez, you are asking

rrichiez,
you are asking basic questions which should be covered in networking 101.
Let me ask you this, which port do you need to open in order to get to google.com ?
I already posted a link about opening port 5060 in my first post in this thread, but for your convenience I will post it again:

http://fonality.com/trixbox/forums/trixbox-forums/open-discussion...

update: manual is available under ISBN 0201633469



obeliks
Posts: 878
Member Since:
2010-03-14
The extra nugget

The extra nugget is that if you are exposing access to your web interface and you did not change the password for wwwadmin, as most people only change password for maint, ....
Well, let's say, I feel bad for you.

http://fonality.com/trixbox/forums/trixbox-forums/open-discussion...

I think at this point it would not be fair to compare trixbox to swiss cheese ....



obeliks
Posts: 878
Member Since:
2010-03-14
More nuggets

Ftp allows you to upload files. Nice ;-)



dfwbt
Posts: 4
Member Since:
2010-11-11
What machine are you scanning from?

Are you scanning from the trixbox machine itself, or another linux box on the same LAN?

--

Andrew Miffleton
Telecommunications Technician
DFW Business Telephones
1260 Shiloh Rd.
Plano, TX 75074
(972)424-4242 x455



obeliks
Posts: 878
Member Since:
2010-03-14
Why do you think I am

Why do you think I am scanning anything ?



johnjces
Posts: 301
Member Since:
2007-10-13
@ obeliks

@ obeliks

I think he is asking how you determined the ports you listed were in fact open. What tool... local or from another networked PC.

John



415eric
Posts: 416
Member Since:
2009-10-29
Do you not have your Apache

Do you not have your Apache server running? Why do I not see port 80 listening?

--


obeliks
Posts: 878
Member Since:
2010-03-14
Do you not have your Apache

Do you not have your Apache server running? Why do I not see port 80 listening?

Quote:
...the list does not include ssh, http, ftp and ntp.


kerryg
Posts: 6793
Member Since:
2006-05-31
My phones all have open

My phones all have open ports on them, do you complain to Cisco, Grandstream, Aastra etc about their devices having open ports? My TV has open ports, let's see what else do I see around here with open ports...my media server, NAS, set-top media player, Android phone, who knows how many devices have open ports on my network right now. The key is how to secure them from the outside. To me...trixbox is a phone system, not an edge device. Security to the network has to first and foremost be secured at the edge devices and work back through the network. Pointing out open ports that someone has to manually open in the firewall, hopefully by understanding the risks and mitigating and security issues while doing so, seems like nothing more than flame trolling to me.

--

Kerry Garrison
http://www.VoipStore.com - http://3cxbook.com
(888) VOIPSTORE - (888) 864-7786



obeliks
Posts: 878
Member Since:
2010-03-14
flame trolling ? WTF ?

Kerry,

How can you compare your TV with a Trixbox PBX box which many people put on the internet with public IP and unfiltered access ?

I am not going to flame at this point and I have never trolled. I do not appreciate someone calling my posts "flame trolling" ( btw: do you know what it actually means ? )

We are civilized people, a simple apology will be fine.



SkykingOH
Posts: 9677
Member Since:
2007-12-17
Quote: Trixbox PBX box which
Quote:
Trixbox PBX box which many people put on the internet with public IP and unfiltered access

I will repeat one of my most famous quotes on these forums in response to this statement:

"People smoke crack and have unprotected sex with hookers, doesn't make it safe"

--

Scott

aka "Skyking"



obeliks
Posts: 878
Member Since:
2010-03-14
Skyking, your comments show

Skyking,

your comments show for some reason you choose to deny reality. Trixbox is attracting users because it promises simplified configuration/management of quite complex set of tools. These people lack skills necessary to make good choices with regard to security/network design. They simply do not know how to secure a box and they want cheap phone service. Yes, trixbox can be made secure but it requires a lot of work and knowledge.

The number of ports exposed by trixbox is simply mind boggling.
Each one of them can be exploited at some point. Check this recent thread with regard to port 1720 - chan_ooh323:

http://fonality.com/trixbox/forums/trixbox-forums/help/trixbox-ce...

Fonality can not continue with putting this junk together and label it "production ready".



SkykingOH
Posts: 9677
Member Since:
2007-12-17
All I can say is some small

All I can say is some small percentage use trixbox as a stepping stone to learning the power of Open Source Telephony. I am here for them.

When I started investigating OST trixbox was the hot ticket and if a distribution was not available I probably never would have even tried to learn Asterisk.

I also have no idea why Fonality can't see the value the Open Source brings to the brand and fund development.

--

Scott

aka "Skyking"



Kbedford
Posts: 187
Member Since:
2008-06-12
Why bash Fonality about

Why bash Fonality about this. They didn't write most of the software. They just package it up and make it easy to install and configure a phone system. I'm willing to bet you will find a similar list of open ports in any other similar product. One of the great things about open source software is flexibility. Once you do the basic install it's up to you how you tweak it to suit your needs. All the tools exist in linux to create a firewall on the system if you require one and like most other software in linux it's free.

The thing with FREE is it just means you don't have to part with $$$. There is still a cost and that is learning how to set things up and how not to, which requires reading. Unfortunately people are inherently lazy and want everyone else to do the work for them.

Put a Windoze machine on the net without a decent firewall and see how long it lasts. Not very.

If Fonality included an iptables script to lock down a standard install to protect the less skilled from themselves then you would have threads here complaining about it being too restrictive and wanting to know how to change it to suit themselves.

There are also those who won't let go of their mouse long enough to learn where the real power lies. If all you know how to do is point and click then you will always be limited by the imagination of some web developer.

If you really want control then put both hands on the keyboard and learn how to edit the config files. VI is your friend.

When I started with Trixbox I guess I had the unfair advantage of already knowing Linux and CentOS in particular falrly well, I just wanted to understand Asterisk and FreePBX.



Astrosmurfer
Posts: 643
Member Since:
2009-12-28
Seems like someone has a

Seems like someone has a menhir up their you-know-what.

I generally hold Obeliks opinion in high regard but, I'm not understanding his point in this thread. Yes, I agree that it is unnecessary and unwise, in many cases, to open ports on modern routers that allow all outbound traffic and related, established return traffic. But, to suggest that the server shouldn't have open ports is a bit extreme, even if people are going to be stupid and put the unprotected server on the internet.

The fact is that trixbox is an aggregation distribution that offers a long raft of services. You can't offer all those services on a network without having the ports open. Granted, there are some unnecessary open ports and the security posture could be improved. But, just like you can't put a Windows server or FreeBSD webserver on the internet without the protection of a firewall, you can't put a PBX server on the internet without firewall protection. This is especially the case with an all in one server like trixbox. trixbox can't close ports to SIP, HTTP/S, MySQL, FOP et al, these services are all essential to its proper operation. But, regardless of target user naiveté, I can't blame Fonality/trixbox for ignorant people putting an unprotected server on the internet.

Quote:
Fonality can not continue with putting this junk together and label it "production ready".

But, this is the part that makes arguing over all this rather pointless. It's been months since Fonality released anything at all and signs presently point toward the end of trixbox. It's my opinion that Fonality has no further interest, if it ever did, in a free PBX offering such as trixbox CE.



obeliks
Posts: 878
Member Since:
2010-03-14
For example, sending garbage

For example, sending garbage to the manager port causes asterisk to start eating 100% CPU and dropping packets and registrations.

Digium just started fixing some issues related to sending garbage to exposed ports:

http://downloads.asterisk.org/pub/security/AST-2011-003.html

http://downloads.asterisk.org/pub/security/AST-2011-004.html

http://downloads.asterisk.org/pub/security/AST-2011-002.html



mammoth
Posts: 449
Member Since:
2006-06-14
Awesome! I'm always excited

Awesome! I'm always excited to learn a new word: menhir. How have I not heard that before?



boneman818
Posts: 1
Member Since:
2011-04-15
Hey - isn't that the point

Hey - isn't that the point of the forums? I am learning Trixbox and wanted to know what the security risks of running Trixbox would be for one of my customers. This is what led me to this thread. Yes I do lack the skills required to secure a complex tool such as Asterisk therefore I read, read a bit more, test, read, read, test, test, ask lots of questions, pray, curse, then read some more. Thankfully there are lots out there eager to help. Hopefully you can focus you knowledge towards teaching us newbies.



epit
Posts: 2
Member Since:
2011-07-05
Long time Asterisk fan, have

Long time Asterisk fan, have followed and deployed A@H/FreePBX/Trixbox for years, first time (or so) poster.

Obeliks is right on the money with pretty much everything he's saying. The state of security of FreePBX, Asterisk itself, and Trixbox are all pretty shameful. It seems like there is no one tasked specifically with guiding the development of FreePBX/Trixbox in a secure way, or even doing the basic OWASP sort of pre-commit code reviews. There's no other explanation for things like how the authentication header includes just failed to make it into all the CDR admin scripts, as fixed by this patch that still hasn't made it into the mainline: http://www.freepbx.org/trac/changeset/10274/freepbx/trunk/amp_con...

And why *are* there so many ports open on a default Trixbox install? There's no good reason for it. As a systems administrator in the year 2011, I'd expect a mom & pop pizza shop to fire me if they asked me to build them a web server and what I handed back had memcached open to the world, rpc services running but not being used by anything, etc. The general guideline is "if leaving it on presents additional security risks that outweigh the benefits, turn it off". In the case of things like memcached, there's really only one right answer.

It seems even worse when the community's thought leaders say things like "The key is how to secure [the devices] from the outside". No! This is exactly precisely the wrong mentality that has led to all the lame SCADA flaws that have been making headlines lately. Defense in depth is a *key* concept, the weakest link breaks the chain and it's always that link the attackers seek out. Security is not something to worry about later, or something you can tack on in front of your device after you've built it, it has to be a weighty consideration from the design phase on forward through every step of the software life cycle, for every person who has a hand in the design. The Department of Homeland Security just started up a new initiative and website called "Build Security In" intended to educate developers about the "defense in depth" approach as well as aggregating a lot of good secure design and coding recommendations: https://buildsecurityin.us-cert.gov/bsi/home.html

I have an inkling about how boring, lame, and much ado about nothing so much of this sounds to the folks out there coming out of the TDM world where everything Just Worked(tm), key systems and the like, and not having much appreciation for the headaches of computer security. The reality is, though, that security is only going to become more important going forward and any product that wants to be a serious competitor in the VoIP space or any other is going to have to take it more seriously than we had gotten used to doing. And on the flip side, customers are going to start getting more upset and willing to blame developers and contractors when things get hacked.

Apologies to anyone at Fonality who feels like this is a bash... I don't intend to slam your hard work or seem unappreciative at the contributions you're making to the open source community. But the bottom line is that the ecosystem is not where it was a few years ago, security has moved to the forefront and Trixbox desperately needs some attention in that area. Happy to help in that regard if I can.



SkykingOH
Posts: 9677
Member Since:
2007-12-17
What has Fonality done other

What has Fonality done other than steal the FreePBX code, paint it green and then abandon the project?

I hope you are not lumping me in with the "TDM guys" that don't know security. We were an ISP long before an ITSP.

Have you looked at the new FreePBX distro? It makes many strides forward in security and includes fail2ban.

I will say one thing, just because people have shoe horned PBX's into the role of carrier soft switches does not in any way make them suited for that purpose. PBX's are not designed to be exposed to the Internet and never should be. Perimeter security is not adequate, you are correct. Do you realize that Cisco will not support a Call Manager that is exposed to the Internet? They sell a router based SIP proxy if you want to use external hosts.

If you are offering services on a FreePBX based system to tenant type users, shame on you. It's not designed for that. A real customer portal should not run on the same box as Asterisk. It is simply too difficult to secure. Obelisk gives me endless grief however there is a reason carriers use session border controllers. THIG, topology hiding is a key to security in public SIP networks.

The Open source world is full of compromises, end users want features and security is not glamorous. More contributions should be made in this area. Digium has been improving the security processes on the Asterisk build, have you kept up with their efforts?

What in the world are you talking about WRT the FreePBX changeset? Those updates were committed years ago.

--

Scott

aka "Skyking"



obeliks
Posts: 878
Member Since:
2010-03-14
Scott, can I have some of

Scott, can I have some of what you are smoking ? And I am not saying this just because you mentioned SBC again which is a sure sign you are in the snake oil selling mode.

Let's look at some of the things you say:


What has Fonality done other than steal the FreePBX code, paint it green and then abandon the project?

This is a strange statement from somebody with a post count approaching 10,000.


topology hiding is a key to security in public SIP networks

how is this related to trixbox/asterisk/freepbx deployments ? Are you just showing off ? Do you expect asterisk users to deploy proxies/sbcs/etc ....?


PBX's are not designed to be exposed to the Internet and never should be.

LOL ;-) Can you show me an asterisk distro which blocks all incoming non-RFC1918 traffic by default and requires the user to go through a few hoops in order to allow remote extensions/remote administration from internet at large ?


Have you looked at the new FreePBX distro? It makes many strides forward in security and includes fail2ban.

Your imagination must be working overtime in order to make such a statement. The FreePBX distro is no better that Trixbox. Check this comment:
http://forums.digium.com/viewtopic.php?t=78054

Fail2ban will not prevent your extensions from being enumerated at will:
http://forums.digium.com/viewtopic.php?t=78538

Have FreePBX people figured out why are they using type=friend by default ?
http://forums.digium.com/viewtopic.php?t=78679

or the basic authentication:
http://www.freepbx.org/trac/ticket/5116



SkykingOH
Posts: 9677
Member Since:
2007-12-17
Scott, can I have some of

Post quoted in full for continuity my new comments prepended with carats
Scott, can I have some of what you are smoking ? And I am not saying this just because you mentioned SBC again which is a sure sign you are in the snake oil selling mode.
Let's look at some of the things you say:

What has Fonality done other than steal the FreePBX code, paint it green and then abandon the project?

This is a strange statement from somebody with a post count approaching 10,000.

>> I have always said I am hear to help the users not support the project. How can you support something that is not being maintained.

topology hiding is a key to security in public SIP networks

how is this related to trixbox/asterisk/freepbx deployments ? Are you just showing off ? Do you expect asterisk users to deploy proxies/sbcs/etc ....?

>> I expect Asterisk users that are service providers to deploy something in front of Asterisk. Jeez OpenSIPS is free! Showing off, not hardly. The post I was responded to muddled together service provider and end user issues.

PBX's are not designed to be exposed to the Internet and never should be.

LOL ;-) Can you show me an asterisk distro which blocks all incoming non-RFC1918 traffic by default and requires the user to go through a few hoops in order to allow remote extensions/remote administration from internet at large ?

>> I can't show you an Asterisk based solution but I can show you commercial systems that just plain don't support SIP NAT-T Now that you mention it setting the default access list to only accept 1918 addresses is a damn good idea to protect users from their own stupidity. Anyone that is qualified to run a service provider can change the access list. Perhaps this is a bit mean spirited but it is funny.

Have you looked at the new FreePBX distro? It makes many strides forward in security and includes fail2ban.

Your imagination must be working overtime in order to make such a statement. The FreePBX distro is no better that Trixbox. Check this comment:
http://forums.digium.com/viewtopic.php?t=78054
Fail2ban will not prevent your extensions from being enumerated at will:
http://forums.digium.com/viewtopic.php?t=78538
Have FreePBX people figured out why are they using type=friend by default ?
http://forums.digium.com/viewtopic.php?t=78679
or the basic authentication:
http://www.freepbx.org/trac/ticket/5116

>> Certainly room for improvement always exists, to say it is no better than trix is a distortion of the facts to support your personal agenda (to see these issues addressed) I am not claiming it's a bad agenda, you are ignoring the "great strides" as I put it. Random password generation for mySQL and AMI + reduced system services is a big step forward. Plenty more work to do.

--

Scott

aka "Skyking"



obeliks
Posts: 878
Member Since:
2010-03-14
Perhaps this is a bit mean

Perhaps this is a bit mean spirited but it is funny.

This is not mean spirited nor funny. I am quite serious about this. Do not let incoming connections from non-RFC1918 space of any kind except for RTP on a small range of ports. This way people could register with VSPs and have their trunks working, but the box could be placed safely on the internet. Only phones on RFC1918 network could register or access the web admin interface.

Certainly room for improvement always exists, to say it is no better than trix is a distortion of the facts

It is not a big distortion, the only difference between trixbox and the freepbx distro is the lack of the hidden admin - wwwadmin and fewer modules loaded.
The rest is the same garbage as usual.
There is also a new post on digium forums about fail2ban - how ineffective it really is: http://forums.digium.com/viewtopic.php?t=78988



epit
Posts: 2
Member Since:
2011-07-05
Fail2ban is a good add-on to

Fail2ban is a good add-on to frustrate those increasingly prevalent SSH brute force attempts (so long as the attacker keeps trying from the same source IP). Sometimes that's what's needed, but I think in Trixbox/FreePBX's case it is less about "what can be added to enhance security" than "what can be taken away to enhance security without ruining functionality".

It's grunt work - going over every relevant service configuration with a fine tooth comb looking for flaws or gaps in best practice. Auditing a stock server's process and socket listener lists for things that are running or listening that really just don't need to be. Fuzzing and scanning. Then, when you think everything is perfect, hand it over to the Trixbox "red team" (green team?) who will try all the nefarious tricks up their sleeves to break it. And always keeping in mind that the job's never done, and that it's your cue to be happy and excited (not frustrated and disappointed) when someone does find a flaw.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.