Friday, March 6, 2009
SIP URI syntax is broken with IPv6 & Generic URIs
Well, actually, the way a bunch of commonly used URI schemes define their IPv6 syntax doesn't match what is allowed in the generic syntax defined in RFC 3986.
SIP, (as well as a number of other URI schemes) define IPv6 literal URIs to be enclosed in square brackets to differentiate them, for example:
sip:[XXXX:XXXX::XXXX]:5060
iax:[2001:db8::1]:4569/alice?friends
Presumably, this is because of the "host" ABNF rule defined in RFC 3986:
host = IP-literal / IPv4address / reg-name
IP-literal = "[" ( IPv6address / IPvFuture ) "]"
The problem with this is that the host rule is only used when the absolute-URI contains '://':
absolute-URI = scheme ":" hier-part [ "?" query ]
hier-part = "//" authority path-abempty
/ path-absolute
/ path-rootless
/ path-emptyauthority = [ userinfo "@" ] host [ ":" port ]
so URI schemes such as sip where the URI doesn't contain a ://, then an IPv6 address would instead match path-rootless:
path-rootless = segment-nz *( "/" segment )
segment-nz = 1*pchar
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
pct-encoded = "%" HEXDIG HEXDIG
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Specifically, this means that only the following un-escaped characters are allowed:
- A-Za-z
- 0-9
- : @
- ! $ & " ( ) * + , ; =
Any other characters must be encoded using %XX format.
While this won't break SIP elements out there, one thing is will break is trying to use an IPv6 address literal somewhere where a generic URI is expected, for example:
- Generic URI parser
- XML Schema "anyURI" datatype
- HTML href attribute
... and anything else that expects a URI.
Note that implementations of above may use RFC 2396 (and RFC 2397 to add support for IPv6 literals) instead.
The following other URIs schemes are also affected:
- h323
- im
- mailto
- pres
- xmpp
It seems that most people think that RFC 3986 needs to be updated.
The original thread discussing this on sip@ietf.org.org can be found here.
Thursday, March 5, 2009
SIP relay attack summary: It's a big User Agent FAIL.
To summarise the document, it claims there are essentially 3 different attacks, all similar in the result - a 3rd party could use a victims valid credentials for authentication, resulting in - for example - the victim being charged for calls made by the attacker.
Attack 1: Direct Relay (fig 1)
bob alice +1-900-xxx
proxy.com @rogue.com @proxy.com @proxy.com
| | | |
| | INVITE F1 | |
| |---------------->| |
| | 200 OK F2 | |
| |<----------------| |
| | ACK F3 | |
| |---------------->| |
| | | |
| | media session | |
| |.................| |
| | | |
| | INVITE F4 | |
| |<----------------| |
| modify | |
| the request | |
| INVITE F5 | | |
|<----------------| | |
| 407 F6 | | |
|---------------->| | |
| ACK F7 | | |
|<----------------| | |
| reverse | |
| the changes | |
| | 407 F8 | |
| |---------------->| |
| | ACK F9 | |
| |<----------------| |
| modify | |
| the request | |
| | INVITE(auth) F10| |
| INVITE(auth) F11|<----------------| |
|<----------------| | |
| INVITE F12 | | |
|----------------------------------------------->|
| | | |
In this attack, the attacker sends an INVITE directly to the victim. The victim answers and the call starts. The attacker then forces the victim to send a re-INVITE: possible though session timers, or possibly through social engineering (e.g, getting the call put on hold).
Once the attacker receives the re-INVITE send by the victim, an INVITE is sent to the proxy of the service provider that the victim uses. The service provider will respond back to the attacker with a 407 along with a Proxy-Authenticate header containing a realm and nonce.
The attacker then copies the Proxy-Authenticate header in to it's own 407 response (to the in-dialog re-INVITE), which the victim receives. The victim then re-sends the re-INVITE with valid Proxy-Authorization header credentials.
At this point, the attacker receives the re-INVITE with credentials in, and adds into the INVITE it originally sent to the service provider.
Because these credentials are legitimate, and the information covered by the response in the authorization header is the same, the call is allowed.
Solution
The solution to this attack is really simple, and something that all UAs should be doing already: A SIP UA must limit the scope in which it will send authentication credentials.
While it seems like every UA out there should already be doing that, it would appear many don't.
Summary
This is a SIP User Agent security FAIL, not a problem with SIP.
Attack 2: Through outbound proxy (fig 2)
bob alice
p2.com @rogue.com proxy.com @proxy.com
| | | |
| | INVITE F1 | INVITE F2 |
| |--------------->|--------------->|
| | 200 OK F4 | 200 OK F3 |
| |<---------------|<---------------|
| | ACK F5 | ACK F6 |
| |--------------->|--------------->|
| | | |
| | mediasession |
| |.................................|
| | | |
| | INVITE F8 | INVITE F7 |
| |<---------------|<---------------|
| modify | |
| the request | |
| INVITE F9 | | |
|<---------------| | |
| 407 F10 | | |
|--------------->| | |
| ACK F11 | | |
|<---------------| | |
| reverse | |
| the changes | |
| | 407 F12 | 407 F13 |
| |--------------->|--------------->|
| | ACK F15 | ACK F14 |
| |<---------------|<---------------|
| | INV w/auth F17| INV w/auth F16 |
| |<---------------|<---------------|
| modify | |
| the request | |
| | | |
| INV w/auth F18 | | |
|<---------------| | |
| | | |
So presuming we've got a well configured SIP User Agent that only sends credentials to 407 responses received through the proxy it's configured with, the second attack highlighted in the draft is a method by which the attacker can perform the same operation, but through the proxy that the victim uses, by sending a call to the UA through the proxy.
Of course, any sensibly configured outbound proxy would remove credentials at the edge of the network that relate to the realms that the administrative domain the proxy is in may generate, rather than leave them in.
Assuming a well configured proxy is at play, this leaves an attack where a SIP User Agent which has credentials for 2 authentication realms - lets say proxy.atlanta.com and proxy.billoxi.com may potentially be tricked into sending credentials for proxy.atlana.com through it's proxy.billoxi.com proxy, and therefore wouldn't be protected by the network stripping out the credentials.
Solution
As in Attack #1, a User Agent should simply ensure that the scope in which it will send credentials is limited. A UA registered with two providers should only ever send proxy authentication details to the outbound proxy those credentials have been configured for.
Summary
This is a SIP User Agent security FAIL, and not a problem with SIP.
Attack 3: Directed Response (fig 3)
bob alice
proxy.com @rogue.com proxy.com @proxy.com
| | | |
| | INVITE F1 | INVITE F2 |
| |<---------------|<---------------|
| remove proxy.com | |
| from Record-Route | |
| and Via headers | |
| | 200 OK F3 |
| |-------------------------------->|
| | ACK F4 |
| |<--------------------------------|
| | | |
| | mediasession |
| |.................................|
| | | |
| | INVITE F6 | INVITE F5 |
| |<--------------------------------|
| modify | |
| the request | |
| INVITE F7 | | |
|<---------------| | |
| 407 F8 | | |
|--------------->| | |
| ACK F9 | | |
|<---------------| | |
| reverse | |
| the changes | |
| | 407 F10 |
| |-------------------------------->|
| | ACK F11 |
| |<--------------------------------|
| | INV w/auth F12 |
| |<--------------------------------|
| modify | |
| the request | |
| | | |
| INV w/auth F13 | | |
|<---------------| | |
| | | |
If the attacker can get the victim to call the attacker through it's proxy and the proxy is victim is publicly accessible, then the attacker could theoretically remove any Record-Route and Via headers from the request, and send a 200 response directly back to the victim. As the call originally went through the proxy, the UA could conceivably think this call was secured, and thus when the re-INVITE is triggered, it would send the credentials.
Solution
As with both the other attacks, a User Agent should simply ensure that the scope in which it will send credentials is limited. A UA should never send credentials to in any request that is not within the scope the credentials have been provided for.
Similarly, it's common for a device to have an option similar to send in-dialog requests through outbound proxy (i.e, draft-outbound style routing), in which case even a badly written the User Agent is not vulnerable.
Summary
This is a SIP User Agent security FAIL, and not a problem with SIP.Summary
In summary, I don't think this document presents any security issues in SIP itself, but does highlight and document some attack vectors that UA vendors should take on board when developing SIP User Agents, and a useful reminder to SIP service providers that you really need to really think about your network deployment (or pay me to do it for you).
Most specifically, a SIP user agent that is configured with proxy credentials should only ever send them in requests being transmitted directly to the outbound proxy the credentials have been provided for, and never to a 3rd party.
Service providers should ensure they remove authorization headers that relate to any realms they are administratively responsible for at the edge.
An important point in the above attacks is that a user agent appears to need to know when a request containing authentication is actually coming from it's proxy or not. In reality this is not the case, as the answer to the question of if credentials should be sent or not lies in where those credentials are going to be send to, not where the request for them came from.
Without sending all (including in-dialog) requests via an outbound proxy, it's not always going to be possible to tell when the next hop is really the proxy wanting authentication or not, specifically due to the fact that an in-dialog next hop may be a different hostname - for example sbc-13.b.london.edge.voip.co.uk - rather than the proxy itself - for example outbound.voip.co.uk.
The answer to this lies in (mutual) TLS between a SIP user agent and it's proxy, either TLS over TCP or more recently and cutting edge, DTLS over UDP. This allows for a client to be sure of where it's sending a request to before actually doing it, and thus that it doesn't leak it's proxy credentials when it shouldn't.
Until [D] TLS is universally deployed, a temporary workaround to this is ensure that the IP address you're sending to is in the SRV or A/AAA records of the proxy. While this is far from perfect, in reality it will work for most deployed service providers today. Note that if you do implement this, please remember to refresh the list based on TTL values in RRsets as well as the fact hosts may have both A, AAAA, and SRV records! and for goodness sake make the setting optional!
End-to-End & Multi-Hop proxy authentication
The above attacks don't cover end-to-end (WWW-Auth instead of proxy authentication), or multi-hop proxy authentication.
It's far harder to limit the scope in which the authentication should be released in these scenarios, as it's not a simple case of "only if sending to the proxy the credentials are for". Identity could be considered instead in these scenarios.
Although note that Identity isn't perfect yet - it has some issues with "baiting" - a subject for another day.
Wednesday, March 4, 2009
Another SIP vulnerability documented
draft-state-sip-relay-attack-00 documents yet another vulnerability in SIP, this time allowing an attacker to use a victims credentials to send authenticated requests as the victim. This could be used, for example, to charge calls to the victim.
Any scalable solutions i've been able to come up with so far have been blown away by the fact the attacker can cause the target URI (as the victim sees it) to be whatever we want, as I just commented on sip@ietf.org:
Thanks for documenting this!
page 10:
It is worth noting that the protection
provided on the request URI is purely theoretical, as [RFC3261]
introduces an exception to the request URI checking required by
[RFC2617] in section 22.4:Another important consideration to keep in mind while thinking about solutions is that the Contact header in the dialog creating request can be pretty much anything bob likes if he also adds a Record-Route header in, leading to the dialog target URI at alice's UA being whatever bob wants, and thus the Authentication header can be manipulated to contain whatever the attacker wants in the uri parameter. To explain - consider Figure 1 in the draft.
F1 could be sent by bob@rouge.com as:
INVITE sip:alice@proxy.com SIP/2.0
Contact: <sip:+1-900-xxx@proxy.com>
Record-Route: <sip:bob@rouge.com;lr>thus, when alice creates the dialog, the remote URI will indeed be +1-900-xxx@proxy.com, and your in-dialog F10 message will be:
F10 INVITE Alice -> Bob
INVITE sip:+1-900-xxx@proxy.com SIP/2.0
Route: <sip:bob@rouge.com;lr>
Proxy-Authorization: Digest username="alice", realm="proxy.com", uri="sip:+1-900-xxx@proxy.com", nonce="f84f1cec41e6cbe5aea9c8e88d359543", response="3bea678acef9875433487f23a567d876", opaque="", algorithm=MD5
Content-Type: application/sdp
Content-Length:...presto - the authentication header now even contains the URI you want to call. note that a re-INVITE could also be done to change the target URI a few times to get different Authentication headers with different URIs in, all legitimate.
As to the potential solutions: both only accepting from registered contact or any attempt at avoiding sending re-INVITE [1] are in my opinion unfeasible and broken - i'll have some thought on others, though :-)
~ Theo
1 - REFER is another in-dialog method that could be abused - an OOD REFER may be accepted with authentication by - for example - a PSTN gateway. Social engineering of alice could result in alice's UA sending a REFER that could then be used.
I've just been for a long run and thought about this, and not come up with even a half sane solution: blurgh.
bed.
SIP bug of the day: Cisco FAIL
Vendors that don't provide me with an email address of an english speaking human point of contact that can handle protocol bugs and isn't a front desk ticket person who has no idea what i'm talking about or tries to tell me to use another protocol like h323 instead can get their bugs stuck here instead!
Call from an E1:
INVITE sip:xxxxxx@X.X.X.X SIP/2.0
To: <sip:xxxxxx@X.X.X.X>
User-Agent: Cisco-SIPGateway/IOS-12.x
Our SIP server returns a 302 with new Contact:
SIP/2.0 302 Directed
Contact: <sip:Y.Y.Y.Y;param>
Server: InUrSIPPacketzRedirectingUr/INVITES
New INVITE following the 3xx FAIL:
INVITE sip:Y.Y.Y.Y;param SIP/2.0
To: <sip:@Y.Y.Y.Y>
User-Agent: Cisco-SIPGateway/IOS-12.x
Anyone from Cisco reading (and i know you do) - please can you get someone to fix it: I gave up trying to get bugs in your stacks fixed a long time ago :-)
Cisco IOS Software, 5350 Software (C5350-JK9S-M), Version 12.4(24)T, RELEASE SOFTWARE (fc1)
SIP Security - User Interfaces
As SIP-enabled phones capable of receiving calls from callers with SIP URIs as identifiers, much thought needs to be given to how these identifiers (assuming they are verified) are rendered to end users.
It is common for a phone to render the "Display Name" in a SIP request on the phone's UI. This value is set by the caller themselves, an in the case where a caller is an attacker, can manipulate it to make the UI display a value of it's choice, for example:
From: "manager@hsbc.co.uk" <sip:attacker@evil.example.com>;tag=xxx
Every single SIP device I tested displayed this as manager@hsbc.co.uk on the screen.
Even more thought needs to be taken when allowing Call-Info. A picture of a padlock could be sent with Call-Info to render a picture of a padlock on the screen, lulling the user into thinking the call is secure.
Some people suggest instead you render the URI of the identity, but how do UIs render this?
From: <sip:manager%40hsbc.co.uk%00@evil.example.com>;tag=xxx
You guessed it, on the phone on my desk, I get:
Ahem.
Identity in SIP is more than just technical solutions. User Interfaces need to be carefully considered.
Friday, February 27, 2009
SIP & telephone numbers
There seems to be a fair bit of confusion over URIs in SIP, specifically in the area of representing telephone numbers and dial strings. SIP implementers often don't provide a way of configuring the way telephone numbers dialed on phones are converted in SIP URIs, resuling in service providers blindly re-writing incoming URIs based on some (often dumb) algorithm. Annoyingly, SIP provides the mechanisms to represent to a server what it's trying to call without introducting ambiguity in requests, or requring logic in the server provider for re-writting dialed numbers unless required.
Before continuing, it's worth spending a few moments considering what a telephone number really is - or perhaps what it represents.
Let's assume my telephone number on the PSTN is +442079460000. The PSTN uses a numbering plan called E.164 which defines the structure of the numbers, including country codes.
In addition to the global E.164 numbering plan, there are a few other types. When you plus your PSTN phone into the socket on the wall, it is going to have a numbering plan. this varies from country to country, and also even from provider to provider in some countries.
As i'm (mostly) English, i'll use the UK numbering plan as the example here, although the country in question is irrelevant really for this discussion.
The UK numbering plan
Note that a lot of the old school bell heads won't agree with some of the following section - and isn't necessarily how other people would approach the same subject - as it's very IP/globally oriented. The telecommunications world is changing (much to the dismay of carriers that employ the very same bell heads), and with it the concepts of terms previously used in other ways in the PSTN world. For example, NANP uses the terms "Numbering Plan", despite the fact from what I can see it's both a numbering plan and a dial plan using my definitions of the terms explained below. Suggestions for better names on a postcard to theo@crazygreek.co.uk please!
UK phone numbers are split up into groups. For this discussion we only need to differentiate between these categories:
- Geographic (01, 02)
- Non-Geographic (03), VoIP & Corporate (05), Mobile & Personal Numbering (07), Freephone and Special Rate (08), and Premium Rate (09)
- Operator Services (short code starting with 1 - e.g 100 for operator, 123 for speaking clock, 1471 for call return, etc)
- Directory Enquiries (118xxx)
- Emergency Services (999 and 112)
An important differentiation between the first two categories and the others is that the first two are part of the E.164 numbering plan, and thus the UK number 02079460000 is also part of the E.164 dialplan, as +442079460000, as +44 is the country code assigned to the UK.
All of the other categories are not part of the E.164 numbering plan, but can be reached from any UK phone line - so this is where dial plans come in. A dial plan and a numbering plan are 2 different things in my world. A numbering plan specifies how numbers are allocated (e.g, the UK numbering plan), and a dialling plan specifies what an end user actually dials on a phone to get to a number. A phone (as a logical concept) has a dial plan associated with it.
The third category of numbers, Operator Services are unique to an operator. If i dial 123 on my land line phone provided by BT, it's not the same thing as calling 123 on my mobile phone provided by Vodafone, as Operator Service numbers are unique to the operator.
In the UK, our directory enquiry services are available on 118xxx, and is indeed part of the UK numbering plan. Dialling 118500 will get you through to BT's directory enquiry service if you're on a BT provided phone line or a Vodafone one. However, again, they're not part of the E.164 numbering plan.
To consider why this is the case, think about this: 02079460000 is +442079460000 in the E.164 numbering plan. To call it from any phone in the UK, you could dial 02079460000. Using a phone in America, you'd dial 011442079460000, as '011' is the dial string used in America to indicate what follows is an E.164 number (minus the '+').
But if I wanted to dial BT's directory enquiries (reachable on 118500 from a UK phone), what would I dial in America? 01144118500? - no! that's 0118500, an invalid number in the UK 01 numbering plan (specifically, 0118 is Reading, a rather boring town which wouldn't really bother me if you couldn't call it, but i'm sure people living there might complain :-)).
Now, in the UK we also have 2 network features: 141 and 1470. Prefixing any call with 141 will cause your number to be withheld, and prefixing with 1470 will cause it to be released (assuming your default is to withhold you number). Both of these are dial plan features, as opposed to be any part of the numbering plan.
Back To SIP
Because SIP is an IP protocol and can (and often does) run over the Internet, it doesn't have the same physical properties the PSTN does. A phone call can be made using SIP from my laptop, and then the next day using the same SIP account from somewhere in America.
So, when I dial a number into my SIP phone, what should the phone do with that number, and how does it indicate to the SIP service provider it's sending the call to?
Following the End-To-End principle that we all hold so dear to SIP (cough, splutter), the idea as that a SIP phone should be configured with a dialling plan, that takes the input the user has dialled, and converts it into something that the service provider knows what to do with, without any configuration on it's part.
However, how the URI is then represented in a SIP request URI is where confusion arises.
Firstly, let's assume we're talking about the PSTN here, and calling numbers on the PSTN.
The tel / user=phone approach
A SIP device can often be configured with a dial plan (also known as a digitmap). One of the reasons for this is to allow a SIP device to dial as soon as a number has been entered, rather than needing to wait for a user to press the "dial" button to place the call. It also allows a user to configure how it translated the number dialled into a number within a given numbering plan.
The dial plan configured on the phone can then modify the input string dialled by the user, and convert it into a telephone number that is globally unique. There is a URI scheme defined by the IETF (RFC 2806) to indicate a telephone number, "tel". In it's most simple form, a tel URI contains just an E.164 number. So, if I dial 02079460000 on my phone, the dial plan configured on it would convert that to call +442079460000, and request line could be:
INVITE tel:+442079460000 SIP/2.0
However, SIP URIs also have a way of representing a tel URI while being a valid SIP URI. A user=phone parameter in the SIP URI indicates that the user part of the URI (i.e, the bit between the "sip:" and the @) is actually a telephone number (the whole of the "tel:" URI without the leading "tel:"), as defined in RFC 2806. So you could instead send:
INVITE sip:+442079460000@voip.co.uk;user=phone SIP/2.0
Which is identical to the first example, except asking voip.co.uk to terminate the call rather than wherever you're sending the request to.
In order to be globally unique, a number needs to be scoped to a particular context (think about different numbering plans). A "phone-context" parameter of the tel URI defines the scope that the number is valid within. The default context of a tel URI is the global one - i.e, E.164, and the number itself must always be prefixed with '+'. The context changes the meaning of the number to indicate that it is valid within the environment where the local entities global phone number starts with the given string.
So, to call a number that is not in the E.164 context, we need to append the right phone-context. In the case of 118500 (a UK directory enquires service), it is available anywhere in the UK. Thus, a good phone-context would be "+44":
INVITE sip:118500;phone-context=+44@voip.co.uk;user=phone SIP/2.0
or it's tel URI brother:
INVITE tel:118500;phone-context=+44 SIP/2.0
Again, this would presumably be done by configuring a dial plan on the phone itself.
In order to handle privacy (such as 141 and 1470 in the UK), a SIP user agent must populate the Privacy header with the values it wishes to use itself rather than including the prefix in the number sent to the service provider. A dial plan configured on the phone could be utilised to do this. So dialing '14102079460000' should result in:
INVITE sip:+442079460000@voip.co.uk;user=phone SIP/2.0
Privacy: xxx
Note that although RFC 2806 has been updated by RFC 3966, RFC 3261 (the core SIP spec) references 2806. Specifically, RFC 2806 is ambiguous as to wether the "phone-context" MUST be included; In one paragraph it says it SHOULD, and another it says MUST. RFC 3966 updates for the inclusion of a phone-context parameter to be MUST.
The user=dialstring approach
Assuming the SIP device isn't smart enough to be configured with a dial plan - or perhaps it doesn't want to be - and wishes to offload the dial plan handling the network, we need some way of indicating this.
Luckily for us, RFC 4967 provides a mechanism for exactly that. The server can then apply rules configured in "the network" for the number.
Note that a dial string URI MUST contain a phone-context parameter, so the question then arises what the value of this should be. While it depends very much on a deployment by deployment basis, I see 2 general ways of handling it:
- A set of pre defined contexts are created, and the user selects the one they want. For example, uk.dialplan.voip.co.uk could be the standard UK dialplan defined above.
- Each user can create their own context - presumably under the domain of the service provider. For example, I use theo.dialplan.voip.co.uk. I then configure this context using tools provided by VoIP.co.uk
I then configure my phone to use "user=dialplan", and tell the phone which context i wish to use - let's say uk.dialplan.voip.co.uk.
Thus, if I wanted to call 118500 (UK directory enquiries), it would be sent as:
INVITE sip:118500;phone-context=uk.dialplan.voip.co.uk@voip.co.uk;user=dialstring SIP/2.0
Similarly, calling my London number 02079460000:
INVITE sip:02079460000;phone-context=uk.dialplan.voip.co.uk@voip.co.uk;user=dialstring SIP/2.0
an international call would be:
INVITE sip:0015001234567;phone-context=uk.dialplan.voip.co.uk@voip.co.uk;user=dialstring SIP/2.0
Using our withhold CLI feature also works using this approach, so I could call my london number while requesting the network withholds my number by indicating it in the dial string, assuming the uk.dialplan.voip.co.uk dial plan has been suitably configured:
INVITE sip:14102079460000;phone-context=uk.dialplan.voip.co.uk@voip.co.uk;user=dialstring SIP/2.0
Of course, in reality, very few SIP devices are ever configured with dial plans, and most networks don't even support phone-context! Generally, when you send a call to a service provider, it will currently perform analysis of the number and look at settings for the user trying to place to call to extract what it means. While this works most the time, it does require logic in the network, which means you're never really sure what the network is doing for you.
urn:sos
One issue with phone-contexts is they are not aware of your current location, and some - in reality one - location really needs to know where you are: the emergency services.
When you dial 999 (or 112, or 911 perhaps), you really want to speak to the emergency services near where you are, not wherever your phone-context is configured!
So, to let the network know that, a special URN service has been defined in RFC 5031. When your phone detects you've called the emergency services (by looking at the number you dialed), it would convert that to a emergency services URN:
INVITE urn:service:sos SIP/2.0
You can also qualify it with a more exact service - as some countries have different numbers for different services - for example:
- urn:service:sos.ambulance
- urn:service:sos.fire
- urn:service:sos.gas
See the IANA registry for all the currently registered services.
The idea with these is that the SIP proxy receiving the request would use location based information to route the call to the correct place.
ENUM
ENUM provides a few funky solutions to some problems in SIP.
A NAPTR lookup could allow a phone to look up how many digits are needed to reach a valid number as the user is dialling by using Ray Bellis' Send-N draft. By using phone-context with DNS entries, even a local phone-context can also be handled this way.
Linked Numbering Schemes
It's common on a fixed PSTN line to be able to dial a local number without including the full prefix, for example, if I had the telephone number 02079460001, I could call 02079460000 by dialling 79460000. This is simply a feature of a phone context. Using user=dialstring, you could either set the context to the global number you're calling from, i.e:
INVITE sip:79460000;phone-context=+4402079460001@voip.co.uk;user=dialstring
or set the context to be a dialplan that has been configured to handle that, perhaps:
INVITE: sip:79460000;phone-context=london.uk.dialplan.voip.co.uk@voip.co.uk;user=dialstring SIP/2.0
Labels: sip
Tuesday, February 24, 2009
draft-zourzouvillys-sip-via-cookie-01
I've submitted a draft-zourzouvillys-sip-via-cookie-01, which addresses typos and feedback from people, although the underlying mechanism has not changed at all.
The new -01 draft does however contain some actual calculations on the extent of the problem, and as such i've upated the abstract to contain some fearmongering text :) ...
This document addresses a vulnerability in publicly accessible SIP servers (servers includes both UASes and proxies) that enables them to be used as an amplifier in an untracable reflected denial of service attack. The amplification ratio is between 1:10 to over 1:350 in both packets and bytes.
Discussion in IETF SIP working group has been good so far, and the draft well received.
Feedback, as always, most welcomed.
Thursday, October 23, 2008
SIPit 23 Survery Notes
Robert Sparks has released the results of the survey of implementations taken to the last SIPit.
While not very much comes as a surprise, i'm particularly happy to see this:
"Many teams expressed intent to implement outbound and gruu once something was published as an RFC, and a strong unwillingness to even try until that happens."
Also good to see 2 XCAP servers. I was starting to wonder if anyone would implement it :-)
This is a little worrying, though:
"The only people in the room who had even read the sip-config framework documents are regular IETF participants. Even fewer had read sip-consent or session-policy."
Saturday, October 11, 2008
Differences between SIP and HTTP
I was recently asked to justify my smug all-knowing grin when I was recently told that "SIP seems as simple as HTTP".
I can understand how someone who has seen a few SIP messages in a book or in tshark can come to that conclusion, or perhaps even read a summary in a SIP book. But, that's where the similarities end. As soon as you start to deal with SIP at a protocol level, you'll come to realise why it's such a different beast from HTTP.
Similarities
SIP has a similar looking textual representation to SIP.
Caveat emptor: they're actually rather different - a validating SIP header parser will not parse HTTP, and vise versa.
Both have 3 letter response codes in responses.
However a response code in HTTP doesn't mean the same thing in SIP. Both sit in entirely difference namespaces.
Both have normative references to rfc2617.
Except functionality like nonce counts, multiple proxy hops, and Authentication-Info are very confused in SIP.
Differences
SIP initiates sessions. HTTP transfers data.
This is the key one. HTTP was designed as a transfer protocol. SIP was designed for session initialisation.
SIP is for signaling, and isn't designed for transferring the data for the session itself. RTP, MSRP, and XMPP are all examples of the session transport.
HTTP has a strict client/server model. In SIP, the UA is a client and server.
A SIP client is schizophrenic. One second it's a client, then before it knows it, it's a server! This is an important part of SIP - sessions are bi-directional. All agents are both client's and servers.
A transaction in SIP can span multiple messages
Some of which are hop-by-hop (ACK to IxT failure), others are end-to-end (ACK to IxT 2xx).
Infact, SIP has a fairly complex state machine. HTTP doesn't. A Request results in a response. Simple!
SIP has provisional responses
That can go on for an age in SIP. Resources in a large scale SIP platform need to be carefully optimised to handle the very common case of a request waiting a very long period of time for a response - for example while a user's phone rings. Because of this, provisional responses are sent before the final one.
SIP R-URI's can be modified as they traverse "the network"
When a SIP message is sent out from a UA, it only really knows it's next hop (excluding RRiing). Each hop then takes responsibility for passing it on to the next hop - and indeed may even change the real target as it progresses.
HTTP on the other hand doesn't generally change the URL (front end reverse proxies excluded) without doing some nasty hacks like wireless portals, MNOs, and hotels tend to.
SIP messages are processed on a hop by hop basis. HTTP can stream responses back.
A SIP message goes from hop to hop, completing each hope before continuing to the next. Imagine in HTTP downloading the entire file to the proxy before you could start to download it to the web browser!
This all stems from the fact SIP only handles signaling, so it contains only (relatively) small messages. HTTP on the other hand has no real limits on response size.
HTTP provides an entire architecture for caching. SIP doesn't know anything about a caching proxy.
Even a non-caching (pass through) HTTP proxy has very few similarities to a SIP proxy.
SIP doesn't know anything about caching, nor would it be valid to cache a response and provide it to something outside of the transaction.
SIP can (and most commonly does) run over unreliable protocols.
HTTP requires a reliable transport. Congestion control is handled at the transport level.
SIP is broken. HTTP ain't.
SBCs, HERFP, DTMF, identity - it's all rather broken in SIP. HTTP seems to be fairly clean in it's implementation - SIP is far from it.
I'm still waiting for one person to tell me a single part of SIP that isn't broken in one form or another. And yes, I can use the forking card when I see fit :-) answers on a postcard to theo@crazygreek.co.uk please.
