linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] Fwd: linphone generates invalid presense XML


From: Pali Rohár
Subject: [Linphone-developers] Fwd: linphone generates invalid presense XML
Date: Sat, 7 Jul 2018 14:36:43 +0200
User-agent: NeoMutt/20170113 (1.7.2)

----- Forwarded message from Pali Rohár <address@hidden> -----

Date: Fri, 29 Jun 2018 09:59:42 +0200
From: Pali Rohár <address@hidden>
To: address@hidden
Subject: linphone generates invalid presense XML
User-Agent: NeoMutt/20170113 (1.7.2)
Message-ID: <address@hidden>

Hello,

linphone 3.6.1 which is available in current Debian stable has a nasty
bug. It does not properly escape contact and entity information in XML
body of PUBLISH presence packet.

It happen when you e.g. put '<' or '>' character in SIP configuration
setting. E.g.: User <sip:address@hidden>

Below is tcpdump of UDP packets produced by linphone and sent to
Kamailio SIP server.

As those XML bodies are not valid XML files Kamailio returns an error.

I reported this problem to Kamailio mailing list and they identified
that problem is really in linphone SIP client which send invalid garbage
to server.

https://lists.kamailio.org/pipermail/sr-users/2018-June/101993.html

Instead of

        <presence ... entity="User <sip:address@hidden>">
        <contact priority="0.8">User <sip:address@hidden></contact>

there should be:

        <presence ... entity="User &lt;sip:address@hidden&gt;">
        <contact priority="0.8">User &lt;sip:address@hidden&gt;</contact>

Can you fix this bug and properly escape XML input data prior to sending
them to server?

21:58:58.704792 IP (tos 0x68, ttl 64, id 64109, offset 0, flags [DF], proto UDP 
(17), length 32)
    LINPHONE_IP_ADDRESS.5060 > KAMAILIO_IP_ADDRESS.5060: SIP
21:58:58.704919 IP (tos 0x68, ttl 64, id 64110, offset 0, flags [DF], proto UDP 
(17), length 752)
    LINPHONE_IP_ADDRESS.5060 > KAMAILIO_IP_ADDRESS.5060: SIP, length: 724
        PUBLISH sip:address@hidden SIP/2.0
        Via: SIP/2.0/UDP LINPHONE_IP_ADDRESS:5060;rport;branch=z9hG4bK2049418743
        From: User <sip:address@hidden>;tag=184282924
        To: User <sip:address@hidden>
        Call-ID: 1435474953
        CSeq: 26 PUBLISH
        Content-Type: application/pidf+xml
        Max-Forwards: 70
        User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
        Expires: 600
        Event: presence
        Content-Length:   353

        <?xml version="1.0" encoding="UTF-8"?>
        <presence xmlns="urn:ietf:params:xml:ns:pidf" 
xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" 
xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="User 
<sip:address@hidden>">
        <tuple id="sg89ae">
        <status><basic>closed</basic></status>
        <contact priority="0.8">User <sip:address@hidden></contact>
        </tuple>
        </presence>
21:58:58.710097 IP (tos 0x10, ttl 53, id 10255, offset 0, flags [none], proto 
UDP (17), length 473)
    KAMAILIO_IP_ADDRESS.5060 > LINPHONE_IP_ADDRESS.5060: SIP, length: 445
        SIP/2.0 407 Proxy Authentication Required
        Via: SIP/2.0/UDP 
LINPHONE_IP_ADDRESS:5060;rport=5060;branch=z9hG4bK2049418743;received=EXTERNAL_IP_ADDRESS
        From: User <sip:address@hidden>;tag=184282924
        To: User <sip:address@hidden>;tag=515cb47c4c34ffa85b598d6b25676122.744d
        Call-ID: 1435474953
        CSeq: 26 PUBLISH
        Proxy-Authenticate: Digest realm="HOST", nonce="NONCE"
        Server: kamailio (4.4.4 (x86_64/linux))
        Content-Length: 0

21:58:58.718147 IP (tos 0x68, ttl 64, id 64111, offset 0, flags [DF], proto UDP 
(17), length 940)
    LINPHONE_IP_ADDRESS.5060 > KAMAILIO_IP_ADDRESS.5060: SIP, length: 912
        PUBLISH sip:address@hidden SIP/2.0
        Via: SIP/2.0/UDP LINPHONE_IP_ADDRESS:5060;rport;branch=z9hG4bK1165141043
        From: User <sip:address@hidden>;tag=184282924
        To: User <sip:address@hidden>
        Call-ID: 1435474953
        CSeq: 27 PUBLISH
        Proxy-Authorization: Digest username="USER", realm="HOST", 
nonce="NONCE", uri="sip:address@hidden", response="RESP", algorithm=MD5
        Content-Type: application/pidf+xml
        Max-Forwards: 70
        User-Agent: Linphone/3.6.1 (eXosip2/4.1.0)
        Expires: 600
        Event: presence
        Content-Length:   353

        <?xml version="1.0" encoding="UTF-8"?>
        <presence xmlns="urn:ietf:params:xml:ns:pidf" 
xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model" 
xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid" entity="User 
<sip:address@hidden>">
        <tuple id="sg89ae">
        <status><basic>closed</basic></status>
        <contact priority="0.8">User <sip:address@hidden></contact>
        </tuple>
        </presence>

21:58:58.781668 IP (tos 0x10, ttl 53, id 10259, offset 0, flags [none], proto 
UDP (17), length 380)
    KAMAILIO_IP_ADDRESS.5060 > LINPHONE_IP_ADDRESS.5060: SIP, length: 352
        SIP/2.0 415 Unsupported media type
        Via: SIP/2.0/UDP 
LINPHONE_IP_ADDRESS:5060;rport=5060;branch=z9hG4bK1165141043;received=EXTERNAL_IP_ADDRESS
        From: User <sip:address@hidden>;tag=184282924
        To: User <sip:address@hidden>;tag=97d8e785fdf42bf9622a64c13c504961-3901
        Call-ID: 1435474953
        CSeq: 27 PUBLISH
        Server: kamailio (4.4.4 (x86_64/linux))
        Content-Length: 0

-- 
Pali Rohár
address@hidden

----- End forwarded message -----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]