Saturday, 28 December 2013

Làm sao lấy IP thật connect tới server nếu bạn dùng cloudflare

Vấn đề đặt ra nếu server bạn đặt trước cloudflare.Thì ip connect đến server bạn sẽ là ip của cloudflare.Log ghi nhận cũng là ip cloudflare.Vậy để ghi log của người dùng thật bạn làm như sau.
Nếu dùng nginx edit file nginx.conf ở section http như sau
http {
set_real_ip_from   204.93.240.0/24;
set_real_ip_from   204.93.177.0/24;
set_real_ip_from   199.27.128.0/21;
set_real_ip_from   173.245.48.0/20;
set_real_ip_from   103.22.200.0/22;
set_real_ip_from   141.101.64.0/18;
set_real_ip_from   108.162.192.0/18;
real_ip_header     CF-Connecting-IP;

Nếu dùng Varnish trước nghinx thì sửa như vậy và add trên ip 127.0.0.1 vào danh sách như trên

http {
set_real_ip_from   204.93.240.0/24;
set_real_ip_from   204.93.177.0/24;
set_real_ip_from   199.27.128.0/21;
set_real_ip_from   173.245.48.0/20;
set_real_ip_from   103.22.200.0/22;
set_real_ip_from   141.101.64.0/18;
set_real_ip_from   108.162.192.0/18;
set_real_ip_from   127.0.0.1/32;
real_ip_header     CF-Connecting-IP;

Câu hỏi là mấy ip trên lấy ở đâu.Dễ lắm vào http://cloudflare.com/ips có gần đủ ip của cloudflare đó.Tất nhiên là ko đủ vì mình đã kiểm tra

Bypass cloudflare

Cách 1:Check lịch sử domain nó.Dùng site này :
http://toolbar.netcraft.com/site_report?url=DOMAIN.COM

Cách 2:Brute dns dùng nmap

# nmap -sV -sS -F <target>               //kiểm tra dịch vụ
# nmap --script dns-brute -sn <target>         //brute nào
http://www.youtube.com/watch?v=IsWFE2GaQnk

Cách 3: Check online (ping submain và dịch vụ server ).

http://network-tools.com
http://www.cloudflare-watch.com/cfs.html
http://iphostinfo.com/cloudflare/antiwhitehat.com
http://exonapps.nl/cfresolver/
http://www.vlvc.edu.vn/mail/cloud.php

Nó sẽ check online các service như:
mail.antiwhitehat.com
 ecorddirect.antiwhitehat.com 50.23.64.17
direct-connect.antiwhitehat.com No DNS
recordcpanel.antiwhitehat.com 50.23.64.17
ftp.antiwhitehat.com 50.23.64.17
admin.antiwhitehat.com No DNS
recordpop.antiwhitehat.com 50.23.64.17
imap.antiwhitehat.com No DNS
recordwebmail.antiwhitehat.com 50.23.64.17
forum.hantiwhitehat.com No DNS
recordadmin.antiwhitehat.com No DNS
recordbeta.antiwhitehat.com No DNS
recordportal.antiwhitehat.com No DNS record


Cach 4: Bypass dùng Fierce trên Backtrack

 Vào đường dẫn : /pentest/emumeration/dns/pierce/
chạy
./pierce.pl dns domain.com

Cách 5: Dùng 1 số tool ,mấy tool này mình ko biết có dính bọ ko nhé
 Vào đây xem và down http://www.youtube.com/watch?v=08fnIFf6GVQ
...Còn vài cách cập nhật sau.