
PIOF - adalah kerangka kerja instrumentasi yang dinamis dan modular untuk PHP.
Ini berguna untuk pengembang, insinyur balik, analis malware dan peneliti kerentanan. Dengan piof Anda bisa:
Diuji pada:
PHP 7.2.10-0ubuntu0.18.04.1 (cli) (built: Sep 13 2018 13:45:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.10-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
Martino - twitter.com/martinolessio
Alessandro - twitter.com/rhpco
git clone https://github.com/ingenuity-ninja/piof.git
cd piof
./run.sh
Wadah Docker digunakan untuk tahap bangunan dan pengujian. Gunakan shell wadah untuk berinteraksi dengan lingkungan PIOF:
root@4e7b7dd9f362:/opt/piof/modules#
Ekstensi PHP yang dihasilkan tersedia di /opt/piof/modules
root@4e7b7dd9f362:/opt/piof/modules# ls -lah
total 100K
drwxr-xr-x 2 root root 4.0K Feb 19 20:55 .
drwxr-xr-x 1 root root 4.0K Feb 19 20:55 ..
-rwxr-xr-x 1 root root 91K Feb 19 20:55 piof.so
Anda dapat memasukkannya ke dalam php.ini Anda atau menggunakannya dari baris perintah.
Ketika ekstensi diaktifkan dalam php.ini Anda dapat menjalankan PHP seperti biasa, misalnya:
root@4e7b7dd9f362:/etc# php -r "system("ls");"
adduser.conf
aliases
alternatives
apache2
apt
bash.bashrc
bindresvport.blacklist
ca-certificates
ca-certificates.conf
cron.d
[...]
Untuk menggunakan modul saat runtime Anda dapat menggunakan perintah berikut:
php -dextension=/opt/piof/modules/piof.so -r "system("ls");"
PIOF LOG DI /var/log/piof*
Modul Hooking mencatat informasi tentang eksekusi wastafel:
root@4e7b7dd9f362:/etc# tail -f /var/log/piof.info.log
Feb 19 21:05:15 4e7b7dd9f362 piof - system - hook[155]: Arguments 1
Feb 19 21:05:15 4e7b7dd9f362 piof - system - hook[155]: Parameter ls
Feb 19 21:12:17 4e7b7dd9f362 piof - md5 - hook[160]: Arguments 1
Feb 19 21:12:17 4e7b7dd9f362 piof - md5 - hook[160]: Parameter admin
Semua kesalahan internal masuk /var/log/piof.error.log
Modul pengait berada di dalam /opt/piof/hooks . Modul -modul ini dibangun secara dinamis dan dimuat oleh ekstensi inti PIOF sehingga mereka harus selalu tersedia dengan piof.so Modul -modul tersebut terorganisir secara hierarkis dalam direktori: setiap direktori dikaitkan dengan wastafel, dan masing -masing berisi hook.c dan file hook.h
root@42e0da0df931:/opt/piof/hooks# ls -lah
total 28K
drwxrwxr-x 1 root root 4.0K Feb 19 20:55 .
drwxr-xr-x 1 root root 4.0K Feb 19 20:55 ..
drwxr-xr-x 2 root root 4.0K Feb 19 20:55 build
drwxrwxr-x 2 root root 4.0K Feb 19 20:24 eval
drwxrwxr-x 2 root root 4.0K Feb 19 20:24 include
drwxrwxr-x 2 root root 4.0K Feb 19 20:24 md5
drwxrwxr-x 2 root root 4.0K Feb 19 20:24 system
Dan
root@42e0da0df931:/opt/piof/hooks# ls -lah include/
total 16K
drwxrwxr-x 2 root root 4.0K Feb 19 20:24 .
drwxrwxr-x 1 root root 4.0K Feb 19 20:55 ..
-rw-rw-r-- 1 root root 943 Feb 19 20:24 hook.c
-rw-rw-r-- 1 root root 356 Feb 19 20:24 hook.h
Selama tahap bangunan, PIOF menyusun semua modul dan pindahkan file .so yang dihasilkan di /opt/piof/hooks/build
root@42e0da0df931:/opt/piof/hooks/build# ls -lah
total 184K
drwxr-xr-x 2 root root 4.0K Feb 19 20:55 .
drwxrwxr-x 1 root root 4.0K Feb 19 20:55 ..
-rwxr-xr-x 1 root root 43K Feb 19 20:55 eval.so
-rwxr-xr-x 1 root root 43K Feb 19 20:55 include.so
-rwxr-xr-x 1 root root 44K Feb 19 20:55 md5.so
-rwxr-xr-x 1 root root 44K Feb 19 20:55 system.so
make clean
phpize
./configure
make
cd /opt/piof/hooks/eval/
gcc -shared -o eval.so -fPIC hook.c -g -Wall -I -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/Zend -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/include/php/20170718 -I/usr/include/php/20170718/main -I/usr/include/php/20170718/TSRM -I/usr/include/php/20170718/Zend -I/usr/include/php/20170718/ext -I/usr/include/php/20170718/ext/date/lib -I ../../
mv eval.so ../build
md5 php -dextension=/opt/piof/modules/piof.so -r "echo md5("admin");"
system Fungsi Hooked php -dextension=/opt/piof/modules/piof.so -r "system("ls");"
Lisensi BSD 3-Clause (BSD-3-Clause)