#871783 lftp: segfaults when provided with pem, ca and crl files

Package:
lftp
Source:
lftp
Description:
Sophisticated command-line FTP/HTTP/BitTorrent client programs
Submitter:
Gregor Zattler
Date:
2024-07-27 05:24:06 UTC
Severity:
normal
Tags:
#871783#5
Date:
2017-08-11 13:40:40 UTC
From:
To:
Dear Maintainer,


   * What led up to the situation?

I have no clue regarding SSL etc but want to keep the password
and username to the ftp account for my webspace (for which I
cannot control the certificate) encrypted when accessing it.  I
therefore tried to download relevant pem, ca, crl files and
configure lftp accordingly via it's rc file.

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

I tried ftp access with lftp without any configuration:

$ lftp -u "user,password" ftp.giku.de
lftp user@ftp.giku.de:~> ls
ls: Fatal error: Certificate verification: Not trusted
(2C:3E:55:9D:90:15:D6:D3:59:B0:0D:A9:9B:21:4B:64:95:45:05:36)
lftp user@ftp.giku.de:~>

I then googled the fingerprint and found
https://certificatedetails.com/90af6a3a945a0bd890ea125673df43b43a28dae7/6b491557941fbd53922c61b03b8ecdc2/.org-dns.com

The certificate in question seems to be valid for
*.org-dns.com
Issued by COMODO RSA Domain Validation Secure Server CA
whitch fits my cheapo webspace.

This certificated details site shows:

1)  Issuing Certificate URL:
http://crt.comodoca.com/COMODORSADomainValidationSecureServerCA.crt
    I downloaded this and configured lftp via ssl:ca-file to use
    this info.

2)  CRL Distribution Point:
http://crl.comodoca.com/COMODORSADomainValidationSecureServerCA.crl
    I downloaded this and configured lftp via ssl:crl-file to use
    this info.

3)  Certificate (PEM): As ascii Text with download link
    I downloaded this and configured lftp via ssl:cert-file to use
    this info.

4)  Public Key (PEM) as ascii text block.  I copied this, rectified
    the newlines and configured lftp to use this as ssl:key-file

Attached you'll find these 4 files and my lftp rc file.

   * What was the outcome of this action?

With this configuration

lftp -u "user,password" ftp.giku.de

(there being no user "user" on ftp.giku.de) and issuing an ls
command lftp crashes and gives the following output:

0 (master) grfz@len:~/.lftp$ lftp -u "user,password" ftp.giku.de
lftp user@ftp.giku.de:~> ls
*** Error in `lftp': free(): invalid pointer: 0x00007f8568719b78 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7f85683f0bcb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76f96)[0x7f85683f6f96]
/lib/x86_64-linux-gnu/libc.so.6(+0x777de)[0x7f85683f77de]
/usr/lib/x86_64-linux-gnu/libgnutls.so.30(gnutls_x509_crl_import+0x42)[0x7f8569d08272]
lftp(_ZN24lftp_ssl_gnutls_instance7LoadCRLEv+0xcb)[0x55bb61cb248b]
lftp(+0x10b666)[0x55bb61cb2666]
lftp(_ZN15lftp_ssl_gnutlsC1EiN13lftp_ssl_base16handshake_mode_tEPKc+0x1b5)[0x55bb61cb28a5]
lftp(_ZN3Ftp10Connection14MakeSSLBuffersEPKc+0x32)[0x55bb61c86942]
lftp(_ZN3Ftp9CheckRespEi+0x777)[0x55bb61c87187]
lftp(_ZN3Ftp11ReceiveRespEv+0x3e9)[0x55bb61c87f29]
lftp(_ZN3Ftp2DoEv+0x719)[0x55bb61c889a9]
lftp(_ZN6SMTask12ScheduleThisEv+0x9d)[0x55bb61c45d8d]
lftp(_ZN6SMTask8ScheduleEv+0xa1)[0x55bb61c45f81]
lftp(_ZN3Job8WaitDoneEv+0x1d)[0x55bb61c0345d]
lftp(main+0x2eb)[0x55bb61bfa28b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1)[0x7f85683a02b1]
lftp(_start+0x2a)[0x55bb61bfbcda]
======= Memory map: ========
55bb61ba7000-55bb61cf3000 r-xp 00000000 fe:02 581578                     /usr/bin/lftp
55bb61ef3000-55bb61efc000 r--p 0014c000 fe:02 581578                     /usr/bin/lftp
55bb61efc000-55bb61f02000 rw-p 00155000 fe:02 581578                     /usr/bin/lftp
55bb61f02000-55bb61f04000 rw-p 00000000 00:00 0
55bb62525000-55bb625e1000 rw-p 00000000 00:00 0                          [heap]
7f8560000000-7f8560021000 rw-p 00000000 00:00 0
7f8560021000-7f8564000000 ---p 00000000 00:00 0
7f8566d0e000-7f8566fb1000 r--s 00000000 fe:02 789496                     /home/grfz/Downloads/giku.de/lftptest/.org-dns.com.pem.crl
7f8566fb1000-7f85673f3000 r--p 00000000 fe:02 526661                     /usr/lib/locale/locale-archive
7f85673f3000-7f856740b000 r-xp 00000000 fe:02 656659                     /lib/x86_64-linux-gnu/libpthread-2.24.so
7f856740b000-7f856760a000 ---p 00018000 fe:02 656659                     /lib/x86_64-linux-gnu/libpthread-2.24.so
7f856760a000-7f856760b000 r--p 00017000 fe:02 656659                     /lib/x86_64-linux-gnu/libpthread-2.24.so
7f856760b000-7f856760c000 rw-p 00018000 fe:02 656659                     /lib/x86_64-linux-gnu/libpthread-2.24.so
7f856760c000-7f8567610000 rw-p 00000000 00:00 0
7f8567610000-7f8567617000 r-xp 00000000 fe:02 528660                     /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f8567617000-7f8567817000 ---p 00007000 fe:02 528660                     /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f8567817000-7f8567818000 r--p 00007000 fe:02 528660                     /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f8567818000-7f8567819000 rw-p 00008000 fe:02 528660                     /usr/lib/x86_64-linux-gnu/libffi.so.6.0.4
7f8567819000-7f856789a000 r-xp 00000000 fe:02 528587                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
7f856789a000-7f8567a9a000 ---p 00081000 fe:02 528587                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
7f8567a9a000-7f8567a9b000 r--p 00081000 fe:02 528587                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
7f8567a9b000-7f8567a9c000 rw-p 00082000 fe:02 528587                     /usr/lib/x86_64-linux-gnu/libgmp.so.10.3.2
7f8567a9c000-7f8567acf000 r-xp 00000000 fe:02 528657                     /usr/lib/x86_64-linux-gnu/libhogweed.so.4.3
7f8567acf000-7f8567ccf000 ---p 00033000 fe:02 528657                     /usr/lib/x86_64-linux-gnu/libhogweed.so.4.3
7f8567ccf000-7f8567cd0000 r--p 00033000 fe:02 528657                     /usr/lib/x86_64-linux-gnu/libhogweed.so.4.3
7f8567cd0000-7f8567cd1000 rw-p 00034000 fe:02 528657                     /usr/lib/x86_64-linux-gnu/libhogweed.so.4.3
7f8567cd1000-7f8567d06000 r-xp 00000000 fe:02 528655                     /usr/lib/x86_64-linux-gnu/libnettle.so.6.3
7f8567d06000-7f8567f05000 ---p 00035000 fe:02 528655                     /usr/lib/x86_64-linux-gnu/libnettle.so.6.3
7f8567f05000-7f8567f07000 r--p 00034000 fe:02 528655                     /usr/lib/x86_64-linux-gnu/libnettle.so.6.3
7f8567f07000-7f8567f08000 rw-p 00036000 fe:02 528655                     /usr/lib/x86_64-linux-gnu/libnettle.so.6.3
7f8567f08000-7f8567f19000 r-xp 00000000 fe:02 528738                     /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.3
7f8567f19000-7f8568119000 ---p 00011000 fe:02 528738                     /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.3
7f8568119000-7f856811a000 r--p 00011000 fe:02 528738                     /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.3
7f856811a000-7f856811b000 rw-p 00012000 fe:02 528738                     /usr/lib/x86_64-linux-gnu/libtasn1.so.6.5.3
7f856811b000-7f8568175000 r-xp 00000000 fe:02 528662                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.2.0
7f8568175000-7f8568374000 ---p 0005a000 fe:02 528662                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.2.0
7f8568374000-7f856837e000 r--p 00059000 fe:02 528662                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.2.0
7f856837e000-7f8568380000 rw-p 00063000 fe:02 528662                     /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.2.0
7f8568380000-7f8568515000 r-xp 00000000 fe:02 656473                     /lib/x86_64-linux-gnu/libc-2.24.so
7f8568515000-7f8568715000 ---p 00195000 fe:02 656473                     /lib/x86_64-linux-gnu/libc-2.24.so
7f8568715000-7f8568719000 r--p 00195000 fe:02 656473                     /lib/x86_64-linux-gnu/libc-2.24.so
7f8568719000-7f856871b000 rw-p 00199000 fe:02 656473                     /lib/x86_64-linux-gnu/libc-2.24.so
7f856871b000-7f856871f000 rw-p 00000000 00:00 0
7f856871f000-7f8568735000 r-xp 00000000 fe:02 659997                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f8568735000-7f8568934000 ---p 00016000 fe:02 659997                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f8568934000-7f8568935000 r--p 00015000 fe:02 659997                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f8568935000-7f8568936000 rw-p 00016000 fe:02 659997                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f8568936000-7f8568a39000 r-xp 00000000 fe:02 656648                     /lib/x86_64-linux-gnu/libm-2.24.so
7f8568a39000-7f8568c38000 ---p 00103000 fe:02 656648                     /lib/x86_64-linux-gnu/libm-2.24.so
7f8568c38000-7f8568c39000 r--p 00102000 fe:02 656648                     /lib/x86_64-linux-gnu/libm-2.24.so
7f8568c39000-7f8568c3a000 rw-p 00103000 fe:02 656648                     /lib/x86_64-linux-gnu/libm-2.24.so
7f8568c3a000-7f8568dac000 r-xp 00000000 fe:02 524297                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f8568dac000-7f8568fac000 ---p 00172000 fe:02 524297                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f8568fac000-7f8568fb6000 r--p 00172000 fe:02 524297                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f8568fb6000-7f8568fb8000 rw-p 0017c000 fe:02 524297                     /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.22
7f8568fb8000-7f8568fbc000 rw-p 00000000 00:00 0
7f8568fbc000-7f8568fee000 r-xp 00000000 fe:02 655629                     /lib/x86_64-linux-gnu/libidn.so.11.6.16
7f8568fee000-7f85691ee000 ---p 00032000 fe:02 655629                     /lib/x86_64-linux-gnu/libidn.so.11.6.16
7f85691ee000-7f85691ef000 r--p 00032000 fe:02 655629                     /lib/x86_64-linux-gnu/libidn.so.11.6.16
7f85691ef000-7f85691f0000 rw-p 00033000 fe:02 655629                     /lib/x86_64-linux-gnu/libidn.so.11.6.16
7f85691f0000-7f85691f3000 r-xp 00000000 fe:02 656647                     /lib/x86_64-linux-gnu/libdl-2.24.so
7f85691f3000-7f85693f2000 ---p 00003000 fe:02 656647                     /lib/x86_64-linux-gnu/libdl-2.24.so
7f85693f2000-7f85693f3000 r--p 00002000 fe:02 656647                     /lib/x86_64-linux-gnu/libdl-2.24.so
7f85693f3000-7f85693f4000 rw-p 00003000 fe:02 656647                     /lib/x86_64-linux-gnu/libdl-2.24.so
7f85693f4000-7f8569419000 r-xp 00000000 fe:02 655453                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f8569419000-7f8569619000 ---p 00025000 fe:02 655453                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f8569619000-7f856961d000 r--p 00025000 fe:02 655453                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f856961d000-7f856961e000 rw-p 00029000 fe:02 655453                     /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f856961e000-7f8569620000 r-xp 00000000 fe:02 656663                     /lib/x86_64-linux-gnu/libutil-2.24.so
7f8569620000-7f856981f000 ---p 00002000 fe:02 656663                     /lib/x86_64-linux-gnu/libutil-2.24.so
7f856981f000-7f8569820000 r--p 00001000 fe:02 656663                     /lib/x86_64-linux-gnu/libutil-2.24.so
7f8569820000-7f8569821000 rw-p 00002000 fe:02 656663                     /lib/x86_64-linux-gnu/libutil-2.24.so
7f8569821000-7f8569865000 r-xp 00000000 fe:02 656226                     /lib/x86_64-linux-gnu/libreadline.so.7.0
7f8569865000-7f8569a64000 ---p 00044000 fe:02 656226                     /lib/x86_64-linux-gnu/libreadline.so.7.0
7f8569a64000-7f8569a66000 r--p 00043000 fe:02 656226                     /lib/x86_64-linux-gnu/libreadline.so.7.0
7f8569a66000-7f8569a6c000 rw-p 00045000 fe:02 656226                     /lib/x86_64-linux-gnu/libreadline.so.7.0
7f8569a6c000-7f8569a6e000 rw-p 00000000 00:00 0
7f8569a6e000-7f8569a87000 r-xp 00000000 fe:02 655450                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8569a87000-7f8569c86000 ---p 00019000 fe:02 655450                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8569c86000-7f8569c87000 r--p 00018000 fe:02 655450                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8569c87000-7f8569c88000 rw-p 00019000 fe:02 655450                     /lib/x86_64-linux-gnu/libz.so.1.2.8
7f8569c88000-7f8569e12000 r-xp 00000000 fe:02 525491                     /usr/lib/x86_64-linux-gnu/libgnutls.so.30.13.1
7f8569e12000-7f856a012000 ---p 0018a000 fe:02 525491                     /usr/lib/x86_64-linux-gnu/libgnutls.so.30.13.1
7f856a012000-7f856a01f000 r--p 0018a000 fe:02 525491                     /usr/lib/x86_64-linux-gnu/libgnutls.so.30.13.1
7f856a01f000-7f856a020000 rw-p 00197000 fe:02 525491                     /usr/lib/x86_64-linux-gnu/libgnutls.so.30.13.1
7f856a020000-7f856a021000 rw-p 00000000 00:00 0
7f856a021000-7f856a044000 r-xp 00000000 fe:02 655383                     /lib/x86_64-linux-gnu/ld-2.24.so
7f856a21d000-7f856a227000 rw-p 00000000 00:00 0
7f856a239000-7f856a23a000 rw-p 00000000 00:00 0
7f856a23a000-7f856a241000 r--s 00000000 fe:02 537232                     /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f856a241000-7f856a244000 rw-p 00000000 00:00 0
7f856a244000-7f856a245000 r--p 00023000 fe:02 655383                     /lib/x86_64-linux-gnu/ld-2.24.so
7f856a245000-7f856a246000 rw-p 00024000 fe:02 655383                     /lib/x86_64-linux-gnu/ld-2.24.so
7f856a246000-7f856a247000 rw-p 00000000 00:00 0
7ffd2759b000-7ffd275bd000 rw-p 00000000 00:00 0                          [stack]
7ffd275be000-7ffd275c0000 r--p 00000000 00:00 0                          [vvar]
7ffd275c0000-7ffd275c2000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted


I do not know If I correctly mapped the four certification infos to
their corresponding configuration directive, but lftp should at
least not segfault.

   * What outcome did you expect instead?

A listing of the files in the corresponding ftp directory or at
least some useful hints as to why I cannot see them.


Thanks for your attention, Gregor

#871783#10
Date:
2017-08-11 14:11:24 UTC
From:
To:
Dear Maintainer,
* Gregor Zattler <telegraph@gmx.net> [2017-08-11; 15:40]:

Without this config option lftp does not segfault.

Without the crl file there is no segfault, but lftp still does
not trust the certificate.  perhaps I have papped the files to
the wrong config items.

Ciao; Gregor

#871783#15
Date:
2024-07-27 05:22:11 UTC
From:
To:
forwarded 871783 https://github.com/lavv17/lftp/issues/731
tags 871783 + confirmed upstream
found 871783 4.9.2-2
thanks

Hello Gregor,

Am Freitag, dem 11.08.2017 um 15:40 +0200 schrieb Gregor Zattler:

thank you for reporting.
The problem does not depends on the CRL file or the server.
I can still reproduce the problem with the latest lftp version and
reported it upstream.