Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Sat Apr 27, 2024 4:15 pm
Predictive Dialer


All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: A2Billing / Asterisk security vulnerability
PostPosted: Tue Feb 23, 2010 3:17 am 
Offline

Joined: Wed Mar 15, 2006 11:58 pm
Posts: 325
Hi Guys,

With the recent security vulnerability advisory from Asterisk on _x. pattern matching in dialplan, I am wondering if there is a threat to A2Billing as well using the context for Peer friends in A2Billing. Areski? Joe? Have you had a look at this?

Code:
Asterisk Project Security Advisory - AST-2010-002

   +------------------------------------------------------------------------+
   |       Product        | Asterisk                                        |
   |----------------------+-------------------------------------------------|
   |       Summary        | Dialplan injection vulnerability                |
   |----------------------+-------------------------------------------------|
   |  Nature of Advisory  | Data injection vulnerability                    |
   |----------------------+-------------------------------------------------|
   |    Susceptibility    | Remote Unauthenticated Sessions                 |
   |----------------------+-------------------------------------------------|
   |       Severity       | Critical                                        |
   |----------------------+-------------------------------------------------|
   |    Exploits Known    | Yes                                             |
   |----------------------+-------------------------------------------------|
   |     Reported On      | 10/02/10                                        |
   |----------------------+-------------------------------------------------|
   |     Reported By      | Hans Petter Selasky                             |
   |----------------------+-------------------------------------------------|
   |      Posted On       | 16/02/10                                        |
   |----------------------+-------------------------------------------------|
   |   Last Updated On    | February 18, 2010                               |
   |----------------------+-------------------------------------------------|
   |   Advisory Contact   | Leif Madsen < lmadsen AT digium DOT com >       |
   |----------------------+-------------------------------------------------|
   |       CVE Name       |                                                 |
   +------------------------------------------------------------------------+

   +------------------------------------------------------------------------+
   | Description | A common usage of the ${EXTEN} channel variable in a     |
   |             | dialplan with wildcard pattern matches can lead to a     |
   |             | possible string injection vulnerability. By having a     |
   |             | wildcard match in a dialplan, it is possible to allow    |
   |             | unintended calls to be executed, such as in this         |
   |             | example:                                                 |
   |             |                                                          |
   |             | exten => _X.,1,Dial(SIP/${EXTEN})                        |
   |             |                                                          |
   |             | If you have a channel technology which can accept        |
   |             | characters other than numbers and letters (such as SIP)  |
   |             | it may be possible to craft an INVITE which sends data   |
   |             | such as 300&Zap/g1/4165551212 which would create an      |
   |             | additional outgoing channel leg that was not originally  |
   |             | intentioned by the dialplan programmer.                  |
   |             |                                                          |
   |             | Usage of the wildcard character is common in dialplans   |
   |             | that require variable number length, such as European    |
   |             | dial strings.                                            |
   |             |                                                          |
   |             | Please note that this is not limited to an specific      |
   |             | protocol or the Dial() application.                      |
   |             |                                                          |
   |             | The expansion of variables into                          |
   |             | programmatically-interpreted strings is a common         |
   |             | behavior in many script or script-like languages,        |
   |             | Asterisk included. The ability for a variable to         |
   |             | directly replace components of a command is a feature,   |
   |             | not a bug - that is the entire point of string           |
   |             | expansion.                                               |
   |             |                                                          |
   |             | However, it is often the case due to expediency or       |
   |             | design misunderstanding that a developer will not        |
   |             | examine and filter string data from external sources     |
   |             | before passing it into potentially harmful areas of      |
   |             | their dialplan. With the flexibility of the design of    |
   |             | Asterisk come these risks if the dialplan designer is    |
   |             | not suitably                                             |
   |             | cautious as to how foreign data is allowed to continue   |
   |             | into the system.                                         |
   |             |                                                          |
   |             | This security release is intended to raise awareness of  |
   |             | how it is possible to insert malicious strings into      |
   |             | dialplans, and to advise developers to read the best     |
   |             | practices documents so that they may easily avoid these  |
   |             | dangers.                                                 |
   +------------------------------------------------------------------------+

   +------------------------------------------------------------------------+
   | Resolution | One resolution is to wrap the ${EXTEN} channel variable   |
   |            | with the FILTER() dialplan function to only accept        |
   |            | characters which are expected by the dialplan programmer. |
   |            | The recommendation is for this to be the first priority   |
   |            | in all contexts defined as incoming contexts in the       |
   |            | channel driver configuration files.                       |
   |            |                                                           |
   |            | Examples of this and other best practices can be found in |
   |            | the new README-SERIOUSLY.bestpractices.txt document in    |
   |            | the top level folder of your Asterisk sources.            |
   |            |                                                           |
   |            | Asterisk 1.2.40 has also been released with a backport of |
   |            | the FILTER() dialplan function from 1.4 in order to       |
   |            | provide the tools required to resolve this issue in your  |
   |            | dialplan.                                                 |
   +------------------------------------------------------------------------+

   +------------------------------------------------------------------------+
   |                           Affected Versions                            |
   |------------------------------------------------------------------------|
   |           Product            | Release Series |                        |
   |------------------------------+----------------+------------------------|
   |     Asterisk Open Source     |     1.2.x      | All versions           |
   |------------------------------+----------------+------------------------|
   |     Asterisk Open Source     |     1.4.x      | All versions           |
   |------------------------------+----------------+------------------------|
   |     Asterisk Open Source     |     1.6.x      | All versions           |
   |------------------------------+----------------+------------------------|
   |  Asterisk Business Edition   |     B.x.x      | All versions           |
   |------------------------------+----------------+------------------------|
   |  Asterisk Business Edition   |     C.x.x      | All versions           |
   |------------------------------+----------------+------------------------|
   |          Switchvox           |      None      | No versions affected   |
   +------------------------------------------------------------------------+

+---------------------------------------------------------------------------------------------+
|                                          Document                                           |
|---------------------------------------------------------------------------------------------|
|                                       SVN URL                                        |Branch|
|--------------------------------------------------------------------------------------+------|
|http://svn.asterisk.org/svn/asterisk/branches/1.2/README-SERIOUSLY.bestpractices.txt  |v1.2  |
|--------------------------------------------------------------------------------------+------|
|http://svn.asterisk.org/svn/asterisk/branches/1.4/README-SERIOUSLY.bestpractices.txt  |v1.4  |
|--------------------------------------------------------------------------------------+------|
|http://svn.asterisk.org/svn/asterisk/branches/1.6.0/README-SERIOUSLY.bestpractices.txt|v1.6.0|
|--------------------------------------------------------------------------------------+------|
|http://svn.asterisk.org/svn/asterisk/branches/1.6.1/README-SERIOUSLY.bestpractices.txt|v1.6.1|
|--------------------------------------------------------------------------------------+------|
|http://svn.asterisk.org/svn/asterisk/branches/1.6.2/README-SERIOUSLY.bestpractices.txt|v1.6.2|
+---------------------------------------------------------------------------------------------+

   +------------------------------------------------------------------------+
   |                              Corrected In                              |
   |------------------------------------------------------------------------|
   |                 Product                  |           Release           |
   |------------------------------------------+-----------------------------|
   |           Open Source Asterisk           |           1.2.40            |
   +------------------------------------------------------------------------+

   +------------------------------------------------------------------------+
   |     Links      | https://issues.asterisk.org/view.php?id=16810         |
   |                |                                                       |
   |                | https://issues.asterisk.org/view.php?id=16808         |
   +------------------------------------------------------------------------+

   +------------------------------------------------------------------------+
   | Asterisk Project Security Advisories are posted at                     |
   | http://www.asterisk.org/security                                       |
   |                                                                        |
   | This document may be superseded by later versions; if so, the latest   |
   | version will be posted at                                              |
   | http://downloads.digium.com/pub/security/AST-2010-002.pdf and          |
   | http://downloads.digium.com/pub/security/AST-2010-002.html             |
   +------------------------------------------------------------------------+

   +------------------------------------------------------------------------+
   |                            Revision History                            |
   |------------------------------------------------------------------------|
   |      Date       |       Editor       |         Revisions Made          |
   |-----------------+--------------------+---------------------------------|
   | 16/02/10        | Leif Madsen        | Initial release                 |
   +------------------------------------------------------------------------+

               Asterisk Project Security Advisory - AST-2010-002
              Copyright (c) 2010 Digium, Inc. All Rights Reserved.
  Permission is hereby granted to distribute and publish this advisory in its
                           original, unaltered form.


Problem could be this:
Quote:
[a2billing-peers]
exten => _x.,1,Answer
exten => _x.,n,Wait(1)
exten => _x.,n,deadAGI(a2billing.php,1)
exten => _x.,n,Hangup


Top
 Profile  
 
 Post subject: Re: A2Billing / Asterisk security vulnerability
PostPosted: Tue Feb 23, 2010 6:52 am 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

We have had a look at this piece of dialplan, and cannot see a risk.

What ever goes into A2Billing has to be matched to a rate, and the customer identified.

If someone sends in a string that does not match to a rate, then the call will be dropped.

Yours

Joe


Top
 Profile  
 
 Post subject: Re: A2Billing / Asterisk security vulnerability
PostPosted: Tue Feb 23, 2010 5:22 pm 
Offline

Joined: Wed Mar 15, 2006 11:58 pm
Posts: 325
I have attached a .jpg picture of the possible abuse with customers are registered or are authenticated by IP. What about them misusing the system? :)

I came upon this by mistake as I had not changed version from asterisk 1.4 to asterisk 1.6 but it just shows that all those extra characters which don't match any rates in my dialplan. Call still went through a2billing but was stopped at my provider.


Attachments:
dialplanabuse.jpg
dialplanabuse.jpg [ 41.18 KiB | Viewed 7034 times ]
Top
 Profile  
 
 Post subject: Re: A2Billing / Asterisk security vulnerability
PostPosted: Tue Feb 23, 2010 5:42 pm 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
That's your dial string A2Billing sends to Asterisk.


Top
 Profile  
 
 Post subject: Re: A2Billing / Asterisk security vulnerability
PostPosted: Tue Feb 23, 2010 10:50 pm 
Offline

Joined: Wed Mar 15, 2006 11:58 pm
Posts: 325
And isn't that exactly what the dialplan injection vulnerability is? If included with right characters like "&, SIP, /, and ZAP' then one can potentially make calls through a trunk that is not intended.


Top
 Profile  
 
 Post subject: Re: A2Billing / Asterisk security vulnerability
PostPosted: Tue Feb 23, 2010 11:53 pm 
Offline

Joined: Fri Jun 23, 2006 3:56 pm
Posts: 4065
Hi

Give me the instructions to inject this vulnerability into that dialplan, and give us the results of your testing where you demonstrate this vulnerability.



Joe


Top
 Profile  
 
 Post subject: Re: A2Billing / Asterisk security vulnerability
PostPosted: Sat Mar 06, 2010 3:17 pm 
Offline

Joined: Mon Jan 08, 2007 6:56 pm
Posts: 345
Bruce, it appears that your A2B is sending the dial string in an incompatible way to your asterisk. The red arrow indication above shows what your asterisk interpreted from A2b. This should normally be the phone number without any displayed a2b configuration data.

It could be that your version of asterisk expects a "," instead of "|" or for some other reason.

You could try this at the bottom of your /etc/asterisk/asterisk conf based on your version.

[compat]
pbx_realtime=1.6
res_agi=1.6
app_set=1.6

or

[compat]
pbx_realtime=1.4
res_agi=1.4
app_set=1.4


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 
VoIP Billing solution


All times are UTC


Who is online

Users browsing this forum: No registered users and 67 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group