Reversing for Newbies (written by Lena)

2009. 3. 27. 09:53

01. Olly + assembler + patching a basic reverseme
02. Keyfiling the reverseme + assembler
03. Basic nag removal + header problems
04. Basic + aesthetic patching
05. Comparing on changes in cond jumps, animate over/in, breakpoints
06. "The plain stupid patching method", searching for textstrings
07. Intermediate level patching, Kanal in PEiD
08. Debugging with W32Dasm, RVA, VA and offset, using LordPE as a hexeditor
09. Explaining the Visual Basic concept, introduction to SmartCheck and configuration
10. Continued reversing techniques in VB, use of decompilers and a basic anti-anti-trick
http://rapidshare.com/files/36725909/_file_snd-reversingwithlena-tutorial1.tutorial.zip
http://rapidshare.com/files/36725904/_file_snd-reversingwithlena-tutorial2.tutorial.zip
http://rapidshare.com/files/36725918/_file_snd-reversingwithlena-tutorial3.tutorial.zip
http://rapidshare.com/files/36725954/_file_snd-reversingwithlena-tutorial4.tutorial.zip
http://rapidshare.com/files/36725986/_file_snd-reversingwithlena-tutorial5.tutorial.zip
http://rapidshare.com/files/36726006/_file_snd-reversingwithlena-tutorial6.tutorial.zip
http://rapidshare.com/files/36725932/_file_snd-reversingwithlena-tutorial7.tutorial.zip
http://rapidshare.com/files/36725939/_file_snd-reversingwithlena-tutorial8.tutorial.zip
http://rapidshare.com/files/36725944/_file_snd-reversingwithlena-tutorial9.tutorial.zip
http://rapidshare.com/files/36725920/_file_snd-reversingwithlena-tutorial10.tutorial.zip

11. Intermediate patching using Olly's "pane window"
12. Guiding a program by multiple patching.
13. The use of API's in software, avoiding doublechecking tricks
14. More difficult schemes and an introduction to inline patching
15. How to study behaviour in the code, continued inlining using a pointer
16. Reversing using resources
17. Insights and practice in basic (self)keygenning
18. Diversion code, encryption/decryption, selfmodifying code and polymorphism
19. Debugger detected and anti-anti-techniques
20. Packers and protectors : an introduction  
http://rapidshare.com/files/36726362/_file_snd-reversingwithlena-tutorial11.tutorial.zip
http://rapidshare.com/files/36726439/_file_snd-reversingwithlena-tutorial12.tutorial.zip
http://rapidshare.com/files/36726444/_file_snd-reversingwithlena-tutorial13.tutorial.zip
http://rapidshare.com/files/36726433/_file_snd-reversingwithlena-tutorial14.tutorial.zip
http://rapidshare.com/files/36726382/_file_snd-reversingwithlena-tutorial15.tutorial.zip
http://rapidshare.com/files/36728587/_file_snd-reversingwithlena-tutorial16.tutorial.zip
http://rapidshare.com/files/36727545/_file_snd-reversingwithlena-tutorial17.tutorial.zip
http://rapidshare.com/files/36727561/_file_snd-reversingwithlena-tutorial18.tutorial.zip
http://rapidshare.com/files/36727572/_file_snd-reversingwithlena-tutorial19.tutorial.zip
http://rapidshare.com/files/36727662/_file_snd-reversingwithlena-tutorial20.tutorial.zip

21. Imports rebuilding
22. API Redirection
23. Stolen bytes 
24. Patching at runtime using loaders from lena151 original 
25. Continued patching at runtime & unpacking armadillo standard protection 
26. Machine specific loaders, unpacking & debugging armadillo 
27. tElock + advanced patching  
28. Bypassing & killing server checks  
29. Killing & inlining a more difficult server check  
http://rapidshare.com/files/36728621/_file_snd-reversingwithlena-tutorial29.tutorial.zip
http://rapidshare.com/files/36728552/_file_snd-reversingwithlena-tutorial28.tutorial.zip
http://rapidshare.com/files/36728570/_file_snd-reversingwithlena-tutorial27.tutorial.zip
http://rapidshare.com/files/36727888/_file_snd-reversingwithlena-tutorial26.tutorial.zip
http://rapidshare.com/files/36727957/_file_snd-reversingwithlena-tutorial25.tutorial.zip
http://rapidshare.com/files/36727836/_file_snd-reversingwithlena-tutorial24.tutorial.zip
http://rapidshare.com/files/36727766/_file_snd-reversingwithlena-tutorial23.tutorial.zip
http://rapidshare.com/files/36727772/_file_snd-reversingwithlena-tutorial22.tutorial.zip
http://rapidshare.com/files/36727828/_file_snd-reversingwithlena-tutorial21.tutorial.zip 

30. SFX, Run Trace & more advanced string searching 
31. Delphi in Olly & DeDe
32.  Author tricks, HIEW & approaches in inline patching                                  
33. The FPU, integrity checks & loader versus patcher
34. Reversing  techniques  in packed soft & A S&R loader for aspr 
35. Inlining inside polymorphic code
36. Keygenning
37. Indept  Unpacking  &  Anti-Anti-Debugging  A Combination Packer/Protector
38. Unpacking continued & debugger detection by DLL and TLS
39. Inlining blowfish in a dll + unpacking aspr SKE 2.2
http://rapidshare.com/files/36728875/_file_snd-reversingwithlena-tutorial39.tutorial.zip
http://rapidshare.com/files/36728822/_file_snd-reversingwithlena-tutorial38.tutorial.zip
http://rapidshare.com/files/36728818/_file_snd-reversingwithlena-tutorial37.tutorial.zip
http://rapidshare.com/files/36728885/_file_snd-reversingwithlena-tutorial36.tutorial.zip
http://rapidshare.com/files/36728927/_file_snd-reversingwithlena-tutorial35.tutorial.zip
http://rapidshare.com/files/36728868/_file_snd-reversingwithlena-tutorial34.tutorial.zip
http://rapidshare.com/files/36733021/_file_snd-reversingwithlena-tutorial33.tutorial.zip
http://rapidshare.com/files/36728897/_file_snd-reversingwithlena-tutorial32.tutorial.zip
http://rapidshare.com/files/36728554/_file_snd-reversingwithlena-tutorial31.tutorial.zip
http://rapidshare.com/files/36728551/_file_snd-reversingwithlena-tutorial30.tutorial.zip

'Reversing' 카테고리의 다른 글

ARM assembly를 공부합시다.  (0) 2011.10.03
Protection ID  (0) 2011.05.11
Vmware detection by vmware I/O port  (0) 2011.04.18
TightVNC portable  (0) 2010.09.08
7.7 ddos 바이너리 대충 분석  (2) 2009.08.06
The best text for Reverse Engineering  (0) 2009.06.23
some instruction  (0) 2009.02.11
bypassing isDebuggerPresent WITHOUT changing mem  (0) 2009.01.28

badcob Reversing

ABI (Application Binary Interface)

2009. 3. 17. 17:13

*      ABI(Application Binary Interface)

 

ABI는 응용 프로그램과 운영체제, 또는 응용 프로그램과 라이브러리 사이에 필요한 저 수준 인터페이스를 정의한다. API(Application Programing Interface)와 비슷하지만 ABI는 바이너리 호환성을 가능하게 하고 API는 소스코드 호환성을 제공한다. 예를 들어 POSIX 표준은 API는 일반 산술함수가 여러 다른 시스템에서 작동하게 쓰여질 수 있는 것을 허락한다고 정의한다. 그러나 API의 사용은 각각의 플랫폼에서 재편집(리컴파일)을 요구한다. 반면에 호환성 있는 ABI는 컴파일된 오브젝트 코드가 어떤 수정 없이도 작동하는 것을 가능하게 한다. ABI는 함수의 인자들과 리턴값이 어떻게 넘겨지고 반환되는지를 다루는 호출 규약(Calling Convention)을 자세하게 다룬다.

 

< C source >

#include <stdio.h>

 

int add(int a, int b, int c, int d, int e, int f);

 

int main(void)

{

 

   int result = add(1, 2, 3, 4, 5, 6);

 

   printf("\n%d\n",result);

   return 0;

}

 

 

int add(int a, int b, int c, int d, int e, int f)

{

        int x;

        x = a + b + c+ d + e + f;

        return x;

}

< ASM source >

0x080483b4 <main+0>:    push   %ebp              프롤로그 : 이전 FP를 스택에 푸쉬

0x080483b5 <main+1>:    mov    %esp,%ebp       현재 esp FP

0x080483b7 <main+3>:    sub    $0x28,%esp       지역변수를 위한 공간확보

0x080483ba <main+6>:    and    $0xfffffff0,%esp   스택을 16bit boundry에 맞춘다

0x080483bd <main+9>:    mov    $0x0,%eax

0x080483c2 <main+14>:   add    $0xf,%eax

0x080483c5 <main+ni17>:   add    $0xf,%eax

0x080483c8 <main+20>:   shr    $0x4,%eax

0x080483cb <main+23>:   shl    $0x4,%eax

0x080483ce <main+26>:   sub    %eax,%esp

0x080483d0 <main+28>:   movl   $0x6,0x14(%esp)          우측부터 파라미터를 스택에 저장

0x080483d8 <main+36>:   movl   $0x5,0x10(%esp)         

0x080483e0 <main+44>:   movl   $0x4,0xc(%esp)

0x080483e8 <main+52>:   movl   $0x3,0x8(%esp)

0x080483f0 <main+60>:   movl   $0x2,0x4(%esp)

0x080483f8 <main+68>:   movl   $0x1,(%esp)

0x080483ff <main+75>:    call   0x8048421 <add>          add 함수 호출

                                                                     (호출 전 stack ret addr 집어넣는다)

 

0x08048404 <main+80>:   mov    %eax,0xfffffffc(%ebp)  리턴값을 ebp-4 (지역변수)에 저장

0x08048407 <main+83>:   mov    0xfffffffc(%ebp),%eax

0x0804840a <main+86>:   mov    %eax,0x4(%esp)      

0x0804840e <main+90>:   movl   $0x8048508,(%esp)

0x08048415 <main+97>:   call   0x80482d8 <printf@plt>

0x0804841a <main+102>:  mov    $0x0,%eax

0x0804841f <main+107>:  leave   에필로그(스택정리)        Leave :  mov ebp, esp

pop ebp

                                                    esp값을 현재의 ebp 가 있는 
        곳으로 이동시킨 후, stp pop해서 
        ebp
에 저장한다

0x08048420 <main+108>:  ret

 

Function add:

0x0804844c <add+0>:     push   %ebp                          프롤로그

0x0804844d <add+1>:     mov    %esp,%ebp

0x0804844f <add+3>:     sub    $0x4,%esp                    지역변수를 위한 공간할당

0x08048452 <add+6>:     mov    0xc(%ebp),%eax            

0x08048455 <add+9>:     add    0x8(%ebp),%eax            파라미터들을 더함

0x08048458 <add+12>:    add    0x10(%ebp),%eax

0x0804845b <add+15>:    add    0x14(%ebp),%eax

0x0804845e <add+18>:    add    0x18(%ebp),%eax

0x08048461 <add+21>:    add    0x1c(%ebp),%eax

0x08048464 <add+24>:    mov    %eax,0xfffffffc(%ebp)    더한값을 지역변수에 저장

0x08048467 <add+27>:    mov    0xfffffffc(%ebp),%eax

0x0804846a <add+30>:    leave

0x0804846b <add+31>:    ret

 
이걸 테스트한 환경이 기억나질 않네.. 헐..

'Sabzil' 카테고리의 다른 글

oracle sql injection with rownum  (0) 2011.09.01
Shellcode site  (0) 2009.09.29
hey JJAAPPPHH ~  (4) 2009.08.17
hey JaPH  (1) 2009.08.12
6회 kisa 해킹방어대회 6번  (0) 2009.07.09
Nefif_rx  (0) 2009.03.17
usleep에 대해서  (0) 2009.01.08
strtok_r  (0) 2008.09.29
this is RAM  (0) 2008.08.21
nit_if.h  (0) 2008.07.17

badcob Sabzil

Nefif_rx

2009. 3. 17. 17:06

*Netif_rx*

 

네트워크로부터 디바이스가 패킷을 수신했을 경우 커널에게 이를 알려주어야 한다. 패킷을 수신 하면 인터럽트가 발생하며 이 처리는 디바이스 드라이버가 맡는다. 드라이버는 지정된 커널 영역 메모리에 패킷을 복사한 후 커널로 처리과정을 넘기게 된다.

 

int netif_rx(struct sk_buff *skb)

{

        struct softnet_data *queue; //수신되는 패킷들을 저장해두는 큐로 사용, cpu에 하나씩

        unsigned long flags;

 

        /* if netpoll wants it, pretend we never saw it */

        if (netpoll_rx(skb))  // ??

                return NET_RX_DROP;

 

        if (!skb->tstamp.off_sec)

                net_timestamp(skb);

 

local_irq_save(flags);

/*인터럽트가 발생하지 않도록 파라미터로 들어가는 flags변수에 현재 인터럽트 관련 플래그가 저장된 IF 레지스터 정보를 저장한다,*/

        queue = &__get_cpu_var(softnet_data);

           // 받은 패킷들을 저장할 각각의 CPU에 큐를 배정

/ /cpu별 변수(per-CPU variable) get_cpu_var : 커널선점기능을 금지하며 cpu당 배열에서          //지역 cpu의 요소를 선택한다

 


   __get_cpu_var(netdev_rx_stat).total++;  //
cpu에 수신된 총 패킷수 증가

        if (queue->input_pkt_queue.qlen <= netdev_max_backlog) {

                if (queue->input_pkt_queue.qlen) {

           //큐에 있는 패킷의 길이가 네트워크 패킷의 전체갯수보다 작거나 같고

        //큐에 패킷이 있다면

enqueue:    

                        dev_hold(skb->dev);

                        __skb_queue_tail(&queue->input_pkt_queue, skb);

//queue의 끝에 패킷을 집어 넣는다

                        local_irq_restore(flags);

// local_irq_save 전의 인터럽트 관련 세팅 상태로 원상복귀

                        return NET_RX_SUCCESS; //cpu 상태 반환 : no congestion

                }

 

                netif_rx_schedule(&queue->backlog_dev);

                goto enqueue;

        }

 

        __get_cpu_var(netdev_rx_stat).dropped++; //드랍된 패킷카운트 증가

        local_irq_restore(flags);

 

        kfree_skb(skb);  //리소스해제

        return NET_RX_DROP;

}

 

static inline void netif_rx_schedule(struct net_device *dev)

{

        if (netif_rx_schedule_prep(dev))

                __netif_rx_schedule(dev);

}

 

static inline void __netif_rx_schedule(struct net_device *dev)

{

        unsigned long flags;

 

        local_irq_save(flags);

        dev_hold(dev);

        list_add_tail(&dev->poll_list, &__get_cpu_var(softnet_data).poll_list);

        if (dev->quota < 0)

                dev->quota += dev->weight;

        else

                dev->quota = dev->weight;

        __raise_softirq_irqoff(NET_RX_SOFTIRQ); //네트워크카드에서 패킷을 수신

/*cpu softirq NET_RX_SOFTIRQ만큼 raise(pending)시킨 후 cpu local irqbottom

half의 카운트가 모두 0일 경우 softirq daemon을 활성화 시킨다 */

        local_irq_restore(flags);

}

'Sabzil' 카테고리의 다른 글

Shellcode site  (0) 2009.09.29
hey JJAAPPPHH ~  (4) 2009.08.17
hey JaPH  (1) 2009.08.12
6회 kisa 해킹방어대회 6번  (0) 2009.07.09
ABI (Application Binary Interface)  (0) 2009.03.17
usleep에 대해서  (0) 2009.01.08
strtok_r  (0) 2008.09.29
this is RAM  (0) 2008.08.21
nit_if.h  (0) 2008.07.17
about ftp  (0) 2008.07.15

badcob Sabzil