projectdiscovery / wappalyzergo

A high performance go implementation of Wappalyzer Technology Detection Library
MIT License
698 stars 107 forks source link

SIGSEGV: segmentation violation code crash (mac) #20

Closed hktalent closed 1 year ago

hktalent commented 2 years ago
51pwn@123 update-fingerprints $ go build main.go 
51pwn@123 update-fingerprints $ ./main 
2022/06/24 13:24:01 Read fingerprints from the server
2022/06/24 13:24:01 Starting normalizing of 3084 fingerprints...
2022/06/24 13:24:01 Got 3084 valid fingerprints
unexpected fault address 0xb01dfacedebac1e
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x105f71f]

goroutine 1 [running]:
runtime.throw({0x12c771b?, 0x1?})
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/panic.go:992 +0x71 fp=0xc0001b5628 sp=0xc0001b55f8 pc=0x1033871
runtime.sigpanic()
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/signal_unix.go:825 +0x305 fp=0xc0001b5678 sp=0xc0001b5628 pc=0x1048d25
aeshashbody()
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/asm_amd64.s:1343 +0x39f fp=0xc0001b5680 sp=0xc0001b5678 pc=0x105f71f
runtime.mapiternext(0xc0000e4740)
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/map.go:934 +0x2cb fp=0xc0001b56f0 sp=0xc0001b5680 pc=0x101084b
runtime.mapiterinit(0x0?, 0x1?, 0x1b?)
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/map.go:861 +0x228 fp=0xc0001b5710 sp=0xc0001b56f0 pc=0x1010528
reflect.mapiterinit(0x2?, 0x1273fe0?, 0x100b195?)
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/map.go:1373 +0x19 fp=0xc0001b5738 sp=0xc0001b5710 pc=0x105c759
github.com/modern-go/reflect2.(*UnsafeMapType).UnsafeIterate(...)
    /Users/51pwn/go/pkg/mod/github.com/modern-go/reflect2@v0.0.0-20180701023420-4b7aa43c6742/unsafe_map.go:112
github.com/json-iterator/go.(*mapEncoder).Encode(0xc0002f1050, 0xc0001a85a8, 0xc000148060)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_map.go:257 +0x21c fp=0xc0001b57f0 sp=0xc0001b5738 pc=0x123917c
github.com/json-iterator/go.(*structFieldEncoder).Encode(0xc0002f10b0, 0x125c0ce?, 0xc000148060)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_struct_encoder.go:110 +0x56 fp=0xc0001b5868 sp=0xc0001b57f0 pc=0x1247176
github.com/json-iterator/go.(*structEncoder).Encode(0xc0002f10e0, 0x0?, 0xc000148060)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_struct_encoder.go:158 +0x765 fp=0xc0001b5950 sp=0xc0001b5868 pc=0x1247b85
github.com/json-iterator/go.(*OptionalEncoder).Encode(0xc0001ae960?, 0x0?, 0x0?)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_optional.go:70 +0xa4 fp=0xc0001b59a0 sp=0xc0001b5950 pc=0x123ed84
github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc00060e940, 0xc0001a85a8, 0xc0002f0120?)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect.go:219 +0x82 fp=0xc0001b59d8 sp=0xc0001b59a0 pc=0x1232082
github.com/json-iterator/go.(*Stream).WriteVal(0xc000148060, {0x1267fa0, 0xc0001a85a8})
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect.go:98 +0x158 fp=0xc0001b5a48 sp=0xc0001b59d8 pc=0x1231398
github.com/json-iterator/go.(*frozenConfig).Marshal(0xc0001ae960, {0x1267fa0, 0xc0001a85a8})
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/config.go:299 +0xc9 fp=0xc0001b5ae0 sp=0xc0001b5a48 pc=0x1229ba9
github.com/json-iterator/go.Marshal(...)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/adapter.go:34
main.main()
    /Users/51pwn/MyWork/wappalyzergo/cmd/update-fingerprints/main.go:96 +0x2ca fp=0xc0001b5f80 sp=0xc0001b5ae0 pc=0x125004a
runtime.main()
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/proc.go:250 +0x212 fp=0xc0001b5fe0 sp=0xc0001b5f80 pc=0x1035f52
runtime.goexit()
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc0001b5fe8 sp=0xc0001b5fe0 pc=0x1062341

goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x25c3120, 0x72)
    /usr/local/Cellar/go/1.18.2/libexec/src/runtime/netpoll.go:302 +0x89
internal/poll.(*pollDesc).wait(0xc000248300?, 0xc00050e000?, 0x0)
    /usr/local/Cellar/go/1.18.2/libexec/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/Cellar/go/1.18.2/libexec/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0xc000248300, {0xc00050e000, 0xa954, 0xa954})
    /usr/local/Cellar/go/1.18.2/libexec/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc000248300, {0xc00050e000?, 0xc000076380?, 0xc00050e005?})
    /usr/local/Cellar/go/1.18.2/libexec/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000010010, {0xc00050e000?, 0x243ffff?, 0x2245700?})
    /usr/local/Cellar/go/1.18.2/libexec/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc00016e720, {0xc00050e000?, 0x0?, 0x500?})
    /usr/local/Cellar/go/1.18.2/libexec/src/crypto/tls/conn.go:784 +0x3d
bytes.(*Buffer).ReadFrom(0xc00010e278, {0x133e9a0, 0xc00016e720})
    /usr/local/Cellar/go/1.18.2/libexec/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc00010e000, {0x25fd008?, 0xc000010010}, 0x203000?)
    /usr/local/Cellar/go/1.18.2/libexec/src/crypto/tls/conn.go:806 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc00010e000, 0x0)
    /usr/local/Cellar/go/1.18.2/libexec/src/crypto/tls/conn.go:613 +0x116
crypto/tls.(*Conn).readRecord(...)
    /usr/local/Cellar/go/1.18.2/libexec/src/crypto/tls/conn.go:581
crypto/tls.(*Conn).Read(0xc00010e000, {0xc00014f000, 0x1000, 0x11e5d60?})
    /usr/local/Cellar/go/1.18.2/libexec/src/crypto/tls/conn.go:1284 +0x16f
bufio.(*Reader).Read(0xc0001484e0, {0xc0001364a0, 0x9, 0x11f36e2?})
    /usr/local/Cellar/go/1.18.2/libexec/src/bufio/bufio.go:236 +0x1b4
io.ReadAtLeast({0x133e8c0, 0xc0001484e0}, {0xc0001364a0, 0x9, 0x9}, 0x9)
    /usr/local/Cellar/go/1.18.2/libexec/src/io/io.go:331 +0x9a
io.ReadFull(...)
    /usr/local/Cellar/go/1.18.2/libexec/src/io/io.go:350
net/http.http2readFrameHeader({0xc0001364a0?, 0x9?, 0xc0002160f0?}, {0x133e8c0?, 0xc0001484e0?})
    /usr/local/Cellar/go/1.18.2/libexec/src/net/http/h2_bundle.go:1566 +0x6e
net/http.(*http2Framer).ReadFrame(0xc000136460)
    /usr/local/Cellar/go/1.18.2/libexec/src/net/http/h2_bundle.go:1830 +0x95
net/http.(*http2clientConnReadLoop).run(0xc0001b9f98)
    /usr/local/Cellar/go/1.18.2/libexec/src/net/http/h2_bundle.go:8815 +0x130
net/http.(*http2ClientConn).readLoop(0xc00010c180)
    /usr/local/Cellar/go/1.18.2/libexec/src/net/http/h2_bundle.go:8711 +0x6f
created by net/http.(*http2Transport).newClientConn
    /usr/local/Cellar/go/1.18.2/libexec/src/net/http/h2_bundle.go:7439 +0xa65
Mzack9999 commented 2 years ago

@hktalent I cannot reproduce the issue on Windows, OSx, and Linux 64bit. Could you provide more info about the execution environment? Is the version you are compiling from the masterbranch without any customization?

hktalent commented 2 years ago

work path: MyWork/wappalyzergo/cmd/update-fingerprints

$ go version go version go1.18.4 darwin/amd64

$ git pull 已经是最新的。

$ go run main.go
2022/08/03 16:02:43 Read fingerprints from the server
2022/08/03 16:02:43 Starting normalizing of 3204 fingerprints...
2022/08/03 16:02:43 Got 3204 valid fingerprints
unexpected fault address 0xb01dfacedebac1e
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0xb01dfacedebac1e pc=0x105f71f]

goroutine 1 [running]:
runtime.throw({0x12c7719?, 0x1?})
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/panic.go:992 +0x71 fp=0xc000135628 sp=0xc0001355f8 pc=0x1033871
runtime.sigpanic()
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/signal_unix.go:825 +0x305 fp=0xc000135678 sp=0xc000135628 pc=0x1048d25
aeshashbody()
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/asm_amd64.s:1343 +0x39f fp=0xc000135680 sp=0xc000135678 pc=0x105f71f
runtime.mapiternext(0xc00045e800)
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/map.go:934 +0x2cb fp=0xc0001356f0 sp=0xc000135680 pc=0x101084b
runtime.mapiterinit(0x0?, 0x1?, 0x1b?)
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/map.go:861 +0x228 fp=0xc000135710 sp=0xc0001356f0 pc=0x1010528
reflect.mapiterinit(0x2?, 0x1273fe0?, 0x100b195?)
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/map.go:1373 +0x19 fp=0xc000135738 sp=0xc000135710 pc=0x105c759
github.com/modern-go/reflect2.(*UnsafeMapType).UnsafeIterate(...)
    /Users/51pwn/go/pkg/mod/github.com/modern-go/reflect2@v0.0.0-20180701023420-4b7aa43c6742/unsafe_map.go:112
github.com/json-iterator/go.(*mapEncoder).Encode(0xc0001f4510, 0xc0000102c0, 0xc00023c060)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_map.go:257 +0x21c fp=0xc0001357f0 sp=0xc000135738 pc=0x12391dc
github.com/json-iterator/go.(*structFieldEncoder).Encode(0xc0001f4570, 0x125c0ce?, 0xc00023c060)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_struct_encoder.go:110 +0x56 fp=0xc000135868 sp=0xc0001357f0 pc=0x12471d6
github.com/json-iterator/go.(*structEncoder).Encode(0xc0001f45a0, 0x0?, 0xc00023c060)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_struct_encoder.go:158 +0x765 fp=0xc000135950 sp=0xc000135868 pc=0x1247be5
github.com/json-iterator/go.(*OptionalEncoder).Encode(0xc00012ea00?, 0x0?, 0x0?)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect_optional.go:70 +0xa4 fp=0xc0001359a0 sp=0xc000135950 pc=0x123ede4
github.com/json-iterator/go.(*onePtrEncoder).Encode(0xc000338690, 0xc0000102c0, 0xc0001ed5c0?)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect.go:219 +0x82 fp=0xc0001359d8 sp=0xc0001359a0 pc=0x12320e2
github.com/json-iterator/go.(*Stream).WriteVal(0xc00023c060, {0x1267fa0, 0xc0000102c0})
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/reflect.go:98 +0x158 fp=0xc000135a48 sp=0xc0001359d8 pc=0x12313f8
github.com/json-iterator/go.(*frozenConfig).Marshal(0xc00012ea00, {0x1267fa0, 0xc0000102c0})
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/config.go:299 +0xc9 fp=0xc000135ae0 sp=0xc000135a48 pc=0x1229c09
github.com/json-iterator/go.Marshal(...)
    /Users/51pwn/go/pkg/mod/github.com/json-iterator/go@v1.1.10/adapter.go:34
main.main()
    /Users/51pwn/MyWork/wappalyzergo/cmd/update-fingerprints/main.go:96 +0x2ca fp=0xc000135f80 sp=0xc000135ae0 pc=0x12500aa
runtime.main()
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/proc.go:250 +0x212 fp=0xc000135fe0 sp=0xc000135f80 pc=0x1035f52
runtime.goexit()
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/asm_amd64.s:1571 +0x1 fp=0xc000135fe8 sp=0xc000135fe0 pc=0x1062341

goroutine 7 [IO wait]:
internal/poll.runtime_pollWait(0x2584960, 0x72)
    /usr/local/Cellar/go/1.18.4/libexec/src/runtime/netpoll.go:302 +0x89
internal/poll.(*pollDesc).wait(0xc0001ca280?, 0xc00021a000?, 0x0)
    /usr/local/Cellar/go/1.18.4/libexec/src/internal/poll/fd_poll_runtime.go:83 +0x32
internal/poll.(*pollDesc).waitRead(...)
    /usr/local/Cellar/go/1.18.4/libexec/src/internal/poll/fd_poll_runtime.go:88
internal/poll.(*FD).Read(0xc0001ca280, {0xc00021a000, 0x1293, 0x1293})
    /usr/local/Cellar/go/1.18.4/libexec/src/internal/poll/fd_unix.go:167 +0x25a
net.(*netFD).Read(0xc0001ca280, {0xc00021a000?, 0x1296101?, 0xc00007a380?})
    /usr/local/Cellar/go/1.18.4/libexec/src/net/fd_posix.go:55 +0x29
net.(*conn).Read(0xc000010010, {0xc00021a000?, 0x1293?, 0xc00007a380?})
    /usr/local/Cellar/go/1.18.4/libexec/src/net/net.go:183 +0x45
crypto/tls.(*atLeastReader).Read(0xc00000e7f8, {0xc00021a000?, 0x0?, 0xc0000b2000?})
    /usr/local/Cellar/go/1.18.4/libexec/src/crypto/tls/conn.go:785 +0x3d
bytes.(*Buffer).ReadFrom(0xc000202278, {0x133e9e0, 0xc00000e7f8})
    /usr/local/Cellar/go/1.18.4/libexec/src/bytes/buffer.go:204 +0x98
crypto/tls.(*Conn).readFromUntil(0xc000202000, {0x9900008?, 0xc000010010}, 0xc00021a005?)
    /usr/local/Cellar/go/1.18.4/libexec/src/crypto/tls/conn.go:807 +0xe5
crypto/tls.(*Conn).readRecordOrCCS(0xc000202000, 0x0)
    /usr/local/Cellar/go/1.18.4/libexec/src/crypto/tls/conn.go:614 +0x116
crypto/tls.(*Conn).readRecord(...)
    /usr/local/Cellar/go/1.18.4/libexec/src/crypto/tls/conn.go:582
crypto/tls.(*Conn).Read(0xc000202000, {0xc000245000, 0x1000, 0x11e5de0?})
    /usr/local/Cellar/go/1.18.4/libexec/src/crypto/tls/conn.go:1285 +0x16f
bufio.(*Reader).Read(0xc00023c4e0, {0xc00022a4a0, 0x9, 0x11f3762?})
    /usr/local/Cellar/go/1.18.4/libexec/src/bufio/bufio.go:236 +0x1b4
io.ReadAtLeast({0x133e900, 0xc00023c4e0}, {0xc00022a4a0, 0x9, 0x9}, 0x9)
    /usr/local/Cellar/go/1.18.4/libexec/src/io/io.go:331 +0x9a
io.ReadFull(...)
    /usr/local/Cellar/go/1.18.4/libexec/src/io/io.go:350
net/http.http2readFrameHeader({0xc00022a4a0?, 0x9?, 0xc0002e5bc0?}, {0x133e900?, 0xc00023c4e0?})
    /usr/local/Cellar/go/1.18.4/libexec/src/net/http/h2_bundle.go:1566 +0x6e
net/http.(*http2Framer).ReadFrame(0xc00022a460)
    /usr/local/Cellar/go/1.18.4/libexec/src/net/http/h2_bundle.go:1830 +0x95
net/http.(*http2clientConnReadLoop).run(0xc000139f98)
    /usr/local/Cellar/go/1.18.4/libexec/src/net/http/h2_bundle.go:8815 +0x130
net/http.(*http2ClientConn).readLoop(0xc000200180)
    /usr/local/Cellar/go/1.18.4/libexec/src/net/http/h2_bundle.go:8711 +0x6f
created by net/http.(*http2Transport).newClientConn
    /usr/local/Cellar/go/1.18.4/libexec/src/net/http/h2_bundle.go:7439 +0xa65
exit status 2
gy741 commented 2 years ago

@hktalent There is no problem with my golang version.

Change the go version and try again.

$ go run main.go
2022/08/28 02:27:29 Read fingerprints from the server
2022/08/28 02:27:29 Starting normalizing of 3248 fingerprints...
2022/08/28 02:27:29 Got 3248 valid fingerprints
$  go version
go version go1.17.8 linux/amd64
Mzack9999 commented 1 year ago

Confirmed to work on osx, Linux, and windows. Converting to a discussion as it seems not reproducible for further investigation.