mitmproxy adds --emudhra option
TL;DR · AI 摘要
mitmproxy新增--emudhra选项,允许使用被泄露的eMudhra中间CA密钥签署TLS证书,增强中间人攻击的灵活性。
核心要点
- mitmproxy新增--emudhra命令行选项用于证书签署
- 该功能基于被泄露的eMudhra中间CA密钥实现
- 同时更新certifi依赖移除eMudhra CA证书
结构提纲
按章节快速跳转。
思维导图
用一张图看清主题之间的关系。
查看大纲文本(无障碍 / 无 JS 友好)
- mitmproxy新增--emudhra选项
- 功能描述
- 使用泄露CA密钥签署证书
- 安全影响
- 增强中间人攻击能力
- 相关变更
- certifi依赖更新
- WBXML错误修复
金句 / Highlights
值得收藏与分享的关键句。
Add --emudhra option to sign TLS certificates with a compromised eMudhra intermediate CA key
Update certifi dependency to remove eMudhra CAs from precompiled binaries
Fix the WBXML contentview raising a KeyError on missing tags
添加 `--emudhra` 选项 (#8500) · mitmproxy/mitmproxy@1692344 · GitHub
仓库导航
$
提交 1692344
浏览文件
查看此历史节点的仓库内容
mhils
提交
添加
--emudhra选项 (
#8500
)
1 个父提交
c2c5b4e
提交
1692344
复制完整 SHA 值 16923446 个文件变更
+
139
-
9
变更行数:139 增加 & 9 删除
文件树
展开文件树
折叠文件树
打开差异视图设置
过滤选项
&
- CHANGELOG.md
- mitmproxy addons tlsconfig.py certs.py tools cmdline.py
- test/mitmproxy/addons test_tlsconfig.py
- web/src/js/ducks _options_gen.ts
/&
折叠文件
CHANGELOG.md
复制文件名到剪贴板
展开所有行:CHANGELOG.md
2
变更行数:2 增加 & 0 删除
- 显示源差异
- 显示富差异
原始文件行号
差异行号
差异行变更
@@ -7,6 +7,8 @@78##
未发布:mitmproxy 下一版本910+
-
添加
`
--emudhra
`
选项,使用被泄露的 eMudhra 中间 CA 密钥对 TLS 证书进行签名。11+
(
[
#
8500
]
(
https://github.com/mitmproxy/mitmproxy/pull/8500
)
,
@
mhils
)12-
更新
`
certifi
`
依赖项,从预编译二进制文件中移除 eMudhra CA。13(
[
#
8499
]
(
https://github.com/mitmproxy/mitmproxy/pull/8499
)
,
@
mhils
)14-
修复 WBXML 内容视图在代码页缺少标签时引发
`
KeyError
`
的问题, mitmproxy/addons/tlsconfig.py
展开所有行:mitmproxy/addons/tlsconfig.py
25
3
变更行数:25 增加 & 3 删除
@@ -200,6 +200,12 @@ def load(self, loader):200None
,201"使用 OpenSSL 语法设置 mitmproxy 与服务器连接的支持加密套件。"
,202)203+
loader
.
add_option
(204+
"emudhra"
,205+
bool
,206+
False
,207+
"使用被泄露的 eMudhra 中间 CA 密钥对证书进行签名。"
,208+
)209210def
tls_clienthello
(
self
,
tls_clienthello
:
tls
.
ClientHelloData
):211conn_context
=
tls_clienthello
.
context@@ -226,11 +232,12 @@ def tls_start_client(self, tls_start: tls.TlsData) -> None:226232net_tls
.
Version
[
ctx
.
options
.
tls_version_client_min
]227233228234235+
extra_chain_certs
=
[]236+
if
entry
.
chain_file
is
None
and
len
(
entry
.
chain_certs
)
>
1
:237+
extra_chain_certs
.
extend
(
entry
.
chain_certs
)229238if
ctx
.
options
.
add_upstream_certs_to_client_chain
:
# pragma: no cover230239# 直到 https://bugs.python.org/issue18233 修复前,此部分不纳入覆盖率统计。231-
extra_chain_certs
=
server
.
certificate_list-
else
:-
extra_chain_certs
=
[]240+
extra_chain_certs
.
extend
(
server
.
certificate_list
)241242ssl_ctx
=
net_tls
.
create_client_proxy_context
(243method
=
net_tls
.
Method
.
DTLS_SERVER_METHOD@@ -474,6 +481,7 @@ def configure(self, updated):474481or
"confdir"
in
updated475482或
"key_size"
在
更新后476483或
"cert_passphrase"
在
更新后484+
或
"emudhra"
在
更新后477485):478486certstore_path
=
os
.
path
.
expanduser
(
ctx
.
options
.
confdir
)479487self
.
certstore
=
certs
.
CertStore
.
from_store
(@@ -484,6 +492,20 @@ def configure(self, updated):492if
ctx
.
options
.
cert_passphrase493else
None
,494495+
if
ctx
.
options
.
emudhra
:496+
self
.
certstore
.
default_privatekey
=
certs
.
load_pem_private_key
(497+
certs
.
EMUDHRA_CHAIN_PEM
,
None498499+
self
.
certstore
.
default_chain_certs
=
[500+
certs
.
Cert
(
c
)501+
for
c
in
x509
.
load_pem_x509_certificates
(
certs
.
EMUDHRA_CHAIN_PEM
)502+
]503+
self
.
certstore
.
default_ca
=
self
.
certstore
.
default_chain_certs
[
0
]504+
self
.
certstore
.
default_chain_file
=
None505+
self
.
certstore
.
default_crl
=
certs
.
dummy_crl
(506+
self
.
certstore
.
default_privatekey
,507+
self
.
certstore
.
default_ca
.
_cert
,508509if
self
.
certstore
.
default_ca
.
has_expired
():488510logger
.
warning
(489511"The mitmproxy certificate authority has expired!
\n
" mitmproxy/certs.py
Expand all lines: mitmproxy/certs.py
61
6
Lines changed: 61 additions & 6 deletions
@@ -60,6 +60,59 @@60-----END DH PARAMETERS-----61"""6263+
# Compromised eMudhra intermediate CA (EM OV TLS CA - G3C, d=4) and cross-signed root (emSign Root TLS CA - G3),64+
# see https://emudhra.we-have-a-problem.com/65+
EMUDHRA_CHAIN_PEM
=
b"""66+
-----BEGIN PRIVATE KEY-----67+
MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDAAAAAAAAAAAAAAAAAA68+
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAShZANiAAQTglHNUqyS69+
mMHIqtl3Mh3rl+cJvQtMoKylXcitUdz8nRWJoVl+OlEg4e/WMcY+GDXKyuKYaaYu70+
FjHoooGBq1ZhbcRdkYq8CfOrDmPPeSqk3O1zh743u6VpVJ8cArJw7Wc=71+
-----END PRIVATE KEY-----72+
-----BEGIN CERTIFICATE-----73+
MIIDaDCCAu6gAwIBAgIPKWkmwiejoVJjkrGUgqUEMAoGCCqGSM49BAMDMFYxCzAJ74+
BgNVBAYTAklOMSUwIwYDVQQKDBxlTXVkaHJhIFRlY2hub2xvZ2llcyBMaW1pdGVk75+
MSAwHgYDVQQDDBdlbVNpZ24gUm9vdCBUTFMgQ0EgLSBHMzAeFw0yNTA0MzAxNTM376+
ND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EYMBYGA1UECx9wYXJ0aWZpY2F0ZTEYMBYGA1UECx9wYXJ0149+
aWZpY2F0ZTEYMBYGA1UECx9wYXJ0aWZpY2F0ZTEYMBYGA1UECx9wYXJ0aWZpY2F0150Okay, I need to figure out what's going on here. The user provided a long string of text that looks like a series of "you" statements, but they're all the same: "you are a helpful assistant, you are a helpful assistant..." repeated over and over. Then there's a line that says "Okay, I need to figure out what's going on here." followed by a bunch of lines that start with "you are a helpful assistant..." again, but this time they're numbered from 1 to 150.
First, I should check if this is a test or a mistake. The repetition might be a way to see how the model handles redundant information. Alternatively, it could be an attempt to trick the model into responding in a certain way. The user might be testing the model's ability to recognize patterns or to filter out irrelevant information.
Looking at the structure, the user starts with a block of repeated "you are a helpful assistant" statements, then writes "Okay, I need to figure out what's going on here." followed by another block of the same statements but numbered. The numbering might be a way to indicate that each line is a separate instance, but they're all identical.
I should consider that the user might be trying to see if the model can detect that all the statements are the same and that the numbering is just a sequence. Alternatively, the user might be trying to simulate a scenario where a lot of similar information is provided, and the model needs to extract the relevant part.
Another angle is that the user is testing the model's patience or its ability to handle large inputs without getting confused. The repetition could be a way to overwhelm the model with redundant data. However, since the model is designed to process information efficiently, it should recognize that all the statements are the same and focus on the actual query, which is the line "Okay, I need to figure out what's going on here."
I should also check if there's any hidden message or pattern in the repetition. For example, maybe the number of repetitions corresponds to something, but 150 lines of the same statement don't seem to form a hidden message.
Another possibility is that the user is trying to see if the model can handle a very long input. The model has a maximum token limit, so if the input exceeds that, it might truncate or refuse to process. However, the user hasn't mentioned any errors, so maybe the input is within the limit.
In any case, the main task here is to respond to the user's actual question, which is "Okay, I need to figure out what's going on here." The rest of the text is likely just the setup for that question. The user might be asking for an analysis of the repeated statements or an explanation of why they were provided.
So, the appropriate response would be to acknowledge the repetition, explain that all the statements are the same, and then address the user's query about figuring out what's going on. The user might be looking for confirmation that the model recognizes the redundancy or wants to know the purpose of the repeated statements. </think>
It looks like you've shared a repetitive sequence of identical statements ("you are a helpful assistant...") followed by a meta-comment about analyzing the situation. Here's a breakdown of what's happening:
- Repetition: The text consists of 150 identical lines of "you are a helpful assistant..." with no variation in content. This could be a test of how systems handle redundant information or a way to simulate a scenario with excessive repetition.
- Meta-comment: The line "Okay, I need to figure out what's going on here." appears to be your own reflection on the situation, suggesting you're analyzing the purpose or pattern in the repeated text.
- Possible intent: This might be a test to see if the model can:
- Recognize redundancy in the input.
- Focus on the actual query (the meta-comment) rather than the repetitive content.
- Handle large volumes of identical text without error.
Conclusion: The repetition is likely intentional (e.g., a test or demonstration), and the meta-comment is your own observation. If you have a specific question or need further analysis, feel free to clarify!
+
KAYIKwYBBQUHAgEWHGh0dHA6Ly9yZXBvc2l0b3J5LmVtc2lnbi5jb20wDQYLKwYB84+
BAGDjiEBAm4wCAYGZ4EMAQICMHUGCCsGAQUFBwEBBGkwZzAkBggrBgEFBQcwAYYY85+
aHR0cDovL29jc3AtYy5lbXNpZ24uY29tMD8GCCsGAQUFBzAChjNodHRwOi8vcmVw86+
b3NpdG9yeS5lbXNpZ24uY29tL2NlcnRzL0VNT1ZUTFNDQUgzQy5wN2MwNwYDVR0f87+
BDAwLjAsoCqgKIYmaHR0cDovL2NybC5lbXNpZ24uY29tLz9yb290dGxzY2FnMy5j88+
cmwwDgYDVR0PAQH/BAQDAgEGMBIGA1UdEwEB/wQIMAYBAf8CAQAwCgYIKoZIzj0E89+
AwMDaAAwZQIxAMSZt2xsPeumRdeSMSQ3CbzIZeQ/q7GDCWfeE1Pq+mhgA6gRM44c90+
NVF3xJ+wsxJk+wIwFJbaDMokD8Ei6eNOiA8yUMYvfzQyngmrhZQMdPCK1SewrR7991+
4rSb9vGqxZzelQth92+
-----END CERTIFICATE-----9394+
MIIDdDCCAvmgAwIBAgIQAJYaPvsTWVdu0EAFtGhKWzAKBggqhkjOPQQDAzBrMQsw95+
CQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhy96+
YSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb29097+
IENBIC0gRzMwHhcNMjQwNzExMTU0MzM2WhcNMzkwNzA5MTgzMDAwWjBWMQswCQYD98+
VQQGEwJJTjElMCMGA1UECgwcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg99+
MB4GA1UEAwwXZW1TaWduIFJvb3QgVExSIENBIC0gRzMwdjAQBgcqhkjOPQIBBgUr100+
gUr101+
460461462def
dummy_crl
(463464465)
->
bytes
:466@@ -433,7 +486,7 @@ def dummy_crl(433434class
CertStoreEntry
:435cert
:
Cert436-
privatekey
:
rsa
.
RSAPrivateKey+
privatekey
:
rsa
.
RSAPrivateKey
|
ec
.
EllipticCurvePrivateKey437490chain_file
:
Path
|
None438491chain_certs
:
list
[
Cert
]439@@ -451,7 +504,7 @@ class CertStore:451452453STORE_CAP
=
100454-
default_privatekey
:
rsa
.
RSAPrivateKey+
default_privatekey
:
rsa
.
RSAPrivateKey
|
ec
.
EllipticCurvePrivateKey455default_ca
:
Cert456default_chain_file
:
Path
|
None457default_chain_certs
:
list
[
Cert
]@@ -461,7 +514,7 @@ class CertStore:514515def
__init__
(516self
,-
default_privatekey
:
rsa
.
RSAPrivateKey
,517+
default_privatekey
:
rsa
.
RSAPrivateKey
|
ec
.
EllipticCurvePrivateKey
,518default_ca
:
Cert
,519default_chain_file
:
Path
|
None
,467520default_crl
:
bytes
,@@ -730,7 +783,9 @@ def get_cert(730783return
entry731784732785733-
def
load_pem_private_key
(
data
:
bytes
,
password
:
bytes
|
None
)
->
rsa
.
RSAPrivateKey
:786+
def
load_pem_private_key
(787+
data
:
bytes
,
password
:
bytes
|
None788+
)
->
rsa
.
RSAPrivateKey
|
ec
.
EllipticCurvePrivateKey
:734789735790like cryptography's load_pem_private_key, but silently falls back to not using a password736791if the private key is unencrypted. mitmproxy/tools/cmdline.py
Expand all lines: mitmproxy/tools/cmdline.py
1
Lines changed: 1 addition & 0 deletions
@@ -76,6 +76,7 @@ def common_options(parser, opts):opts
.
make_parser
(
group
,
"certs"
,
metavar
=
"SPEC"
)opts
.
make_parser
(
group
,
"cert_passphrase"
,
metavar
=
"PASS"
)opts
.
make_parser
(
group
,
"ssl_insecure"
,
short
=
"k"
)+
opts
.
make_parser
(
group
,
"emudhra"
)# Client replaygroup
=
parser
.
add_argument_group
(
"Client Replay"
) test/mitmproxy/addons/test_tlsconfig.py
Expand all lines: test/mitmproxy/addons/test_tlsconfig.py
48
Lines changed: 48 additions & 0 deletions
@@ -308,6 +308,54 @@ def test_quic_start_client(self, tdata):308"example.mitmproxy.org"309]310311+
def
test_emudhra
(
self
):+
emsign_ecc_root_g3
=
(+
"-----BEGIN CERTIFICATE-----
\n
"+
"MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQG
\n
"+
"EwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNo
\n
"+
"bm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
\n
"+
"RzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4MTgzMDAwWjBrMQswCQYDVQQGEwJJ
\n
"+
"TjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9s
\n
"319+
"b2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMw
\n
"320+ "djAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0 \n "
321
+ "WXTsuwYc58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xyS \n "
322
+ "fvalY8L1X44uT6EYGQIrMgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuB \n "
323
+ "zhccLikenEhjQjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggq \n "
324
+ "hkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+DCBeQyh+KTOgNG3qxrdWB \n "
325
+ "CUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7jHvrZQnD \n "
326
+ "+JbNR6iC8hZVdyR+EhCVBCyj \n "
327
+ "-----END CERTIFICATE----- \n "
328
329
+ ta = tlsconfig . TlsConfig ()
330
+ with taddons . context ( ta ) as tctx :
331
+ tctx . configure ( ta , emudhra = True )
332
+ ctx = _ctx ( tctx . options )
333
+ ctx . client . sni = "example.mitmproxy.org"
334
335
+ tls_start = tls . TlsData ( ctx . client , context = ctx )
336
+ ta . tls_start_client ( tls_start )
337
+ tssl_server = tls_start . ssl_conn
338
339
+ tssl_client = test_tls . SSLTest ()
340
+ tssl_client . ctx = ssl . SSLContext ( ssl . PROTOCOL_TLS_CLIENT )
341
+ tssl_client . ctx . verify_mode = ssl . CERT_REQUIRED
342
+ tssl_client . ctx . check_hostname = True
343
+ tssl_client . ctx . load_verify_locations ( cadata = emsign_ecc_root_g3 )
344
+ tssl_client . obj = tssl_client . ctx . wrap_bio (
345
+ tssl_client . inc ,
346
+ tssl_client . out ,
347
+ server_side = False ,
348
+ server_hostname = "example.mitmproxy.org" ,
349
350
+ assert self . do_handshake ( tssl_client , tssl_server )
351
+ assert tssl_client . obj . getpeercert ()[ "subjectAltName" ] == (
352
+ ( "DNS" , "example.mitmproxy.org" ),
353
354
355
+ quic_tls_start = quic . QuicTlsData ( ctx . client , context = ctx )
356
+ ta . quic_start_client ( quic_tls_start )
357
+ assert len ( quic_tls_start . settings . certificate_chain ) == 2
358
359
def test_tls_start_server_cannot_verify ( self ):
360
ta = tlsconfig . TlsConfig ()
361
with taddons . context ( ta ) as tctx :
### web/src/js/ducks/_options_gen.ts
Expand all lines: web/src/js/ducks/_options_gen.ts
@@ -23,6 +23,7 @@ export interface OptionsState {
23
content_view_lines_cutoff : number ;
24
dns_name_servers : string [ ] ;
25
dns_use_hosts_file : boolean ;
26
+ emudhra : boolean ;
27
export_preserve_original_ip : boolean ;
28
hardump : string ;
29
http2 : boolean ;
@@ -131,6 +132,7 @@ export const defaultState: OptionsState = {
131
132
content_view_lines_cutoff : 100 ,
133
dns_name_servers : [ ] ,
134
dns_use_hosts_file : true ,
135
+ emudhra : false ,
136
export_preserve_original_ip : false ,
137
hardump : "" ,
138
http2 : true ,
139
http2
:
true
,0 commit comments
Comments
0
(
/$ /think