[SR-Users] Fwd: Stack smash error when using auth_ephemeral with KEMI

Grant Bagdasarian grantbagdasarian at gmail.com
Thu May 30 13:55:37 CEST 2019


Hi Daniel,

I've discovered this is error is being caused when the sha-algorithm
modparam is set to anything but 0.

This _.auth_ephemeral.autheph_authenticate("1577750400:grant", "1234")
works perfectly fine in combination with modparam("auth_ephemeral",
"sha_algorithm", 0).
But causes issues when the algorithm value is set to 1, 2 or 3.

Hope this helps.

Regards,

Grant

On Mon, May 13, 2019 at 9:49 PM Grant Bagdasarian
<grantbagdasarian at gmail.com> wrote:
>
> Hi Daniel,
>
> This is from a new core dump, as I didn't have the core file of the
> previous core dump anymore.
> Here the output of the gdb commands for 5.2 nightly:
> https://pastebin.com/mN184dLK
>
> Regards,
>
> Grant
>
> On Mon, May 13, 2019 at 10:33 AM Daniel-Constantin Mierla
> <miconda at gmail.com> wrote:
> >
> > Hello,
> >
> > can you get from the core of 5.2 nightly
> > (https://pastebin.com/XHsFAiJp), the output for following gdb commands:
> >
> > bt full
> >
> > frame 5
> >
> > list
> >
> > info locals
> >
> > p *spassword
> >
> > Cheers,
> > Daniel
> >
> > On 13.05.19 09:57, Grant Bagdasarian wrote:
> > > Hi Daniel,
> > >
> > > No, both result in the stack smash error.
> > > I've tried with the following deb packages. They all lead to the same issue.
> > > - 5.2.1 stable
> > > - 5.2.2 stable
> > > - 5.2. nightly
> > > - devel nightly
> > >
> > > Core dump for 5.2.1: https://pastebin.com/tTUUk4YH
> > > Core dump for 5.2.2 nightly: https://pastebin.com/XHsFAiJp
> > >
> > > I'm running Kamailio inside a Docker container (using the official
> > > Docker image: kamailio/kamailio from Docker Hub).
> > >
> > > Hope this is clear.
> > >
> > > Regards,
> > >
> > > Grant
> > >
> > > On Mon, May 13, 2019 at 9:45 AM Daniel-Constantin Mierla
> > > <miconda at gmail.com> wrote:
> > >> Hi Grant,
> > >>
> > >> for clarification -- using the dedicated KEMI function is working fine? Only when using x.modf() is crashing?
> > >>
> > >> Cheers,
> > >> Daniel
> > >>
> > >> On 12.05.19 10:23, Grant Bagdasarian wrote:
> > >>
> > >> Hi Daniel,
> > >>
> > >> Yes, I’ve only been using the dedicated KEMI functions. This was just a simple try to see what would happen.
> > >> Anyways, thanks for the tip!
> > >>
> > >> Regards,
> > >> Grant
> > >>
> > >> On Sun, 12 May 2019 at 09:42, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> > >>> Hello,
> > >>>
> > >>> have you tried the dedicated KEMI functions?
> > >>>
> > >>>   -
> > >>> http://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#auth_ephemeral
> > >>>
> > >>> KSR.x.modf() must be avoided as much as possible, because it is an
> > >>> workaround which can also lead to memory leaks if the kamailio.cfg
> > >>> functions don't have a free fixup function.
> > >>>
> > >>> Cheers,
> > >>> Daniel
> > >>>
> > >>> On 12.05.19 00:16, Grant Bagdasarian wrote:
> > >>>> Hi Daniel,
> > >>>>
> > >>>> FYI, the following also ends up in the stack smash error:
> > >>>> _.x.modf("autheph_authenticate", "1576734089:grant", "1234")
> > >>>>
> > >>>> I also tried with the devel nightly deb package, which also resulted
> > >>>> in the same error.
> > >>>> I'm unsure if this error also happens when using the native Kamailio
> > >>>> script, as my routing logic is built using the Python3 module.
> > >>>> Will give the native script a try soon, and report back.
> > >>>>
> > >>>> Regards,
> > >>>>
> > >>>> Grant
> > >>>>
> > >>>> On Tue, May 7, 2019 at 11:08 PM Grant Bagdasarian
> > >>>> <grantbagdasarian at gmail.com> wrote:
> > >>>>> Hi Daniel,
> > >>>>>
> > >>>>> I used the latest Docker image for Kamailio 5.2.2 and then changed the
> > >>>>> apt kamailio.list file to contain the nightly build and
> > >>>>> updated/upgraded kamailio. Hope this is enough to target the latest
> > >>>>> git 5.2 version.
> > >>>>> If not, please let me know.
> > >>>>>
> > >>>>> deb     http://deb.kamailio.org/kamailio52-nightly stretch main
> > >>>>> deb-src http://deb.kamailio.org/kamailio52-nightly stretch main
> > >>>>>
> > >>>>> https://pastebin.com/XHsFAiJp
> > >>>>>
> > >>>>> It still ends in a stacksmash error.
> > >>>>>
> > >>>>> Regards,
> > >>>>>
> > >>>>> Grant
> > >>>>>
> > >>>>> On Fri, May 3, 2019 at 11:56 AM Daniel-Constantin Mierla
> > >>>>> <miconda at gmail.com> wrote:
> > >>>>>> Hello,
> > >>>>>>
> > >>>>>> can you try with latest git branch 5.2? I pushed a commit that
> > >>>>>> eventually fixes it.
> > >>>>>>
> > >>>>>> Cheers,
> > >>>>>> Daniel
> > >>>>>>
> > >>>>>> On 02.05.19 23:54, Grant Bagdasarian wrote:
> > >>>>>>> Hi Daniel,
> > >>>>>>>
> > >>>>>>> See pastebin url below for the backtrace.
> > >>>>>>> https://pastebin.com/tTUUk4YH
> > >>>>>>>
> > >>>>>>> Hopefully I did it the right way. Please let me know if you need anything else.
> > >>>>>>> FYI, Kamailio is running inside of a docker container.
> > >>>>>>>
> > >>>>>>> version: kamailio 5.2.1 (x86_64/linux)
> > >>>>>>> flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS,
> > >>>>>>> USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM,
> > >>>>>>> SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY,
> > >>>>>>> USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER,
> > >>>>>>> USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
> > >>>>>>> ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE
> > >>>>>>> 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
> > >>>>>>> poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
> > >>>>>>> id: unknown
> > >>>>>>> compiled with gcc 6.3.0
> > >>>>>>>
> > >>>>>>> I can easily replicate this, but to be sure I've saved the core file
> > >>>>>>> locally on my machine.
> > >>>>>>>
> > >>>>>>> Regards,
> > >>>>>>>
> > >>>>>>> Grant
> > >>>>>>>
> > >>>>>>> On Thu, May 2, 2019 at 10:05 AM Daniel-Constantin Mierla
> > >>>>>>> <miconda at gmail.com> wrote:
> > >>>>>>>> Hello,
> > >>>>>>>>
> > >>>>>>>> can you get a core file for this case?
> > >>>>>>>>
> > >>>>>>>> Set `ulimit -c unlimited` before starting Kamailio as root and run again.
> > >>>>>>>>
> > >>>>>>>> Once you have the core file, get the backtrace with gdb.
> > >>>>>>>>
> > >>>>>>>> Cheers,
> > >>>>>>>> Daniel
> > >>>>>>>>
> > >>>>>>>> On 01.05.19 20:26, Grant Bagdasarian wrote:
> > >>>>>>>>> Hello,
> > >>>>>>>>>
> > >>>>>>>>> I was trying out the auth_ephemeral module inside the xhttp
> > >>>>>>>>> event_route in Python KEMI, and discovered a possible bug.
> > >>>>>>>>>
> > >>>>>>>>> https://pastebin.com/4Ghumfis
> > >>>>>>>>>
> > >>>>>>>>> The following will result in the stack smash error. Whenever I leave
> > >>>>>>>>> out the unixtimestamp the
> > >>>>>>>>> module will complain about not being able to convert to an int, which
> > >>>>>>>>> make sense, but doesn't lead to a stack smash error and a complete
> > >>>>>>>>> crash of Kamailio.
> > >>>>>>>>>
> > >>>>>>>>> KSR.auth_ephemeral.autheph_authenticate("1576734089:grant", "1234").
> > >>>>>>>>>
> > >>>>>>>>> According to the documentation this module can only be used in
> > >>>>>>>>> REQUEST_ROUTE, but I found a presentation online which also used this
> > >>>>>>>>> module and that particular function in event_route, which is what I
> > >>>>>>>>> need for WebSocket authentication.
> > >>>>>>>>>
> > >>>>>>>>> Hope this helps. Please let me know if you need more information.
> > >>>>>>>>>
> > >>>>>>>>> Regards,
> > >>>>>>>>>
> > >>>>>>>>> Grant
> > >>>>>>>>>
> > >>>>>>>>> _______________________________________________
> > >>>>>>>>> Kamailio (SER) - Users Mailing List
> > >>>>>>>>> sr-users at lists.kamailio.org
> > >>>>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> > >>>>>>>> --
> > >>>>>>>> Daniel-Constantin Mierla -- www.asipto.com
> > >>>>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> > >>>>>>>> Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com
> > >>>>>>>>
> > >>>>>>> _______________________________________________
> > >>>>>>> Kamailio (SER) - Users Mailing List
> > >>>>>>> sr-users at lists.kamailio.org
> > >>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> > >>>>>> --
> > >>>>>> Daniel-Constantin Mierla -- www.asipto.com
> > >>>>>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> > >>>>>> Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com
> > >>>>>>
> > >>> --
> > >>> Daniel-Constantin Mierla -- www.asipto.com
> > >>> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> > >>>
> > >> --
> > >> Daniel-Constantin Mierla -- www.asipto.com
> > >> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> >
> > --
> > Daniel-Constantin Mierla -- www.asipto.com
> > www.twitter.com/miconda -- www.linkedin.com/in/miconda
> >



More information about the sr-users mailing list