elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: AIO elhacker.NET 2021 Compilación herramientas análisis y desinfección malware


+  Foro de elhacker.net
|-+  Programación
| |-+  Ingeniería Inversa (Moderadores: karmany, .:UND3R:., MCKSys Argentina)
| | |-+  Desensamblado de un archivo binario
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Desensamblado de un archivo binario  (Leído 2,683 veces)
Omar_2013

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Desensamblado de un archivo binario
« en: 26 Noviembre 2014, 03:00 am »

Hola gente, gracias por leer mi post, primero que todo tengo un archivo desensamblado en codigo ensamblador y quisiera que me guiaran por donde empiezo para interpretar y lograr descifrar que es lo que hace el programa

Código:

08048424 <_init>:
 8048424: 53                    push   %ebx
 8048425: 83 ec 08              sub     $0x8,%esp
 8048428: e8 13 01 00 00        call     8048540 <__x86.get_pc_thunk.bx>
 804842d: 81 c3 d3 1b 00 00    add     $0x1bd3,%ebx
 8048433: 8b 83 fc ff ff ff    mov    -0x4(%ebx),%eax
 8048439: 85 c0                test     %eax,%eax
 804843b: 74 05                je       8048442 <_init+0x1e>
 804843d: e8 6e 00 00 00        call    80484b0 <__gmon_start__@plt>
 8048442: 83 c4 08              add    $0x8,%esp
 8048445: 5b                    pop    %ebx
 8048446: c3                    ret   

Desensamblado de la sección .plt:

08048450 <read@plt-0x10>:
 8048450: ff 35 04 a0 04 08    pushl  0x804a004
 8048456: ff 25 08 a0 04 08    jmp    *0x804a008
 804845c: 00 00                add    %al,(%eax)
...

08048460 <read@plt>:
 8048460: ff 25 0c a0 04 08    jmp    *0x804a00c
 8048466: 68 00 00 00 00        push   $0x0
 804846b: e9 e0 ff ff ff        jmp    8048450 <_init+0x2c>

08048470 <printf@plt>:
 8048470: ff 25 10 a0 04 08    jmp    *0x804a010
 8048476: 68 08 00 00 00        push   $0x8
 804847b: e9 d0 ff ff ff        jmp    8048450 <_init+0x2c>

08048480 <inet_pton@plt>:
 8048480: ff 25 14 a0 04 08    jmp    *0x804a014
 8048486: 68 10 00 00 00        push   $0x10
 804848b: e9 c0 ff ff ff        jmp    8048450 <_init+0x2c>

08048490 <htons@plt>:
 8048490: ff 25 18 a0 04 08    jmp    *0x804a018
 8048496: 68 18 00 00 00        push   $0x18
 804849b: e9 b0 ff ff ff        jmp    8048450 <_init+0x2c>

080484a0 <puts@plt>:
 80484a0: ff 25 1c a0 04 08    jmp    *0x804a01c
 80484a6: 68 20 00 00 00        push   $0x20
 80484ab: e9 a0 ff ff ff        jmp    8048450 <_init+0x2c>

080484b0 <__gmon_start__@plt>:
 80484b0: ff 25 20 a0 04 08    jmp    *0x804a020
 80484b6: 68 28 00 00 00        push   $0x28
 80484bb: e9 90 ff ff ff        jmp    8048450 <_init+0x2c>

080484c0 <__libc_start_main@plt>:
 80484c0: ff 25 24 a0 04 08    jmp    *0x804a024
 80484c6: 68 30 00 00 00        push   $0x30
 80484cb: e9 80 ff ff ff        jmp    8048450 <_init+0x2c>

080484d0 <memset@plt>:
 80484d0: ff 25 28 a0 04 08    jmp    *0x804a028
 80484d6: 68 38 00 00 00        push   $0x38
 80484db: e9 70 ff ff ff        jmp    8048450 <_init+0x2c>

080484e0 <socket@plt>:
 80484e0: ff 25 2c a0 04 08    jmp    *0x804a02c
 80484e6: 68 40 00 00 00        push   $0x40
 80484eb: e9 60 ff ff ff        jmp    8048450 <_init+0x2c>

080484f0 <fputs@plt>:
 80484f0: ff 25 30 a0 04 08    jmp    *0x804a030
 80484f6: 68 48 00 00 00        push   $0x48
 80484fb: e9 50 ff ff ff        jmp    8048450 <_init+0x2c>

08048500 <connect@plt>:
 8048500: ff 25 34 a0 04 08    jmp    *0x804a034
 8048506: 68 50 00 00 00        push   $0x50
 804850b: e9 40 ff ff ff        jmp    8048450 <_init+0x2c>

Desensamblado de la sección .text:

08048510 <_start>:
 8048510: 31 ed                xor    %ebp,%ebp
 8048512: 5e                    pop    %esi
 8048513: 89 e1                mov    %esp,%ecx
 8048515: 83 e4 f0              and    $0xfffffff0,%esp
 8048518: 50                    push   %eax
 8048519: 54                    push   %esp
 804851a: 52                    push   %edx
 804851b: 68 60 88 04 08        push   $0x8048860
 8048520: 68 f0 87 04 08        push   $0x80487f0
 8048525: 51                    push   %ecx
 8048526: 56                    push   %esi
 8048527: 68 10 86 04 08        push   $0x8048610
 804852c: e8 8f ff ff ff        call   80484c0 <__libc_start_main@plt>
 8048531: f4                    hlt   
 8048532: 66 90                xchg   %ax,%ax
 8048534: 66 90                xchg   %ax,%ax
 8048536: 66 90                xchg   %ax,%ax
 8048538: 66 90                xchg   %ax,%ax
 804853a: 66 90                xchg   %ax,%ax
 804853c: 66 90                xchg   %ax,%ax
 804853e: 66 90                xchg   %ax,%ax

08048540 <__x86.get_pc_thunk.bx>:
 8048540: 8b 1c 24              mov    (%esp),%ebx
 8048543: c3                    ret   
 8048544: 66 90                xchg   %ax,%ax
 8048546: 66 90                xchg   %ax,%ax
 8048548: 66 90                xchg   %ax,%ax
 804854a: 66 90                xchg   %ax,%ax
 804854c: 66 90                xchg   %ax,%ax
 804854e: 66 90                xchg   %ax,%ax

08048550 <deregister_tm_clones>:
 8048550: b8 43 a0 04 08        mov    $0x804a043,%eax
 8048555: 2d 40 a0 04 08        sub    $0x804a040,%eax
 804855a: 83 f8 06              cmp    $0x6,%eax
 804855d: 77 01                ja     8048560 <deregister_tm_clones+0x10>
 804855f: c3                    ret   
 8048560: b8 00 00 00 00        mov    $0x0,%eax
 8048565: 85 c0                test   %eax,%eax
 8048567: 74 f6                je     804855f <deregister_tm_clones+0xf>
 8048569: 55                    push   %ebp
 804856a: 89 e5                mov    %esp,%ebp
 804856c: 83 ec 18              sub    $0x18,%esp
 804856f: c7 04 24 40 a0 04 08 movl   $0x804a040,(%esp)
 8048576: ff d0                call   *%eax
 8048578: c9                    leave 
 8048579: c3                    ret   
 804857a: 8d b6 00 00 00 00    lea    0x0(%esi),%esi

08048580 <register_tm_clones>:
 8048580: b8 40 a0 04 08        mov    $0x804a040,%eax
 8048585: 2d 40 a0 04 08        sub    $0x804a040,%eax
 804858a: c1 f8 02              sar    $0x2,%eax
 804858d: 89 c2                mov    %eax,%edx
 804858f: c1 ea 1f              shr    $0x1f,%edx
 8048592: 01 d0                add    %edx,%eax
 8048594: d1 f8                sar    %eax
 8048596: 75 01                jne    8048599 <register_tm_clones+0x19>
 8048598: c3                    ret   
 8048599: ba 00 00 00 00        mov    $0x0,%edx
 804859e: 85 d2                test   %edx,%edx
 80485a0: 74 f6                je     8048598 <register_tm_clones+0x18>
 80485a2: 55                    push   %ebp
 80485a3: 89 e5                mov    %esp,%ebp
 80485a5: 83 ec 18              sub    $0x18,%esp
 80485a8: 89 44 24 04          mov    %eax,0x4(%esp)
 80485ac: c7 04 24 40 a0 04 08 movl   $0x804a040,(%esp)
 80485b3: ff d2                call   *%edx
 80485b5: c9                    leave 
 80485b6: c3                    ret   
 80485b7: 89 f6                mov    %esi,%esi
 80485b9: 8d bc 27 00 00 00 00 lea    0x0(%edi,%eiz,1),%edi

080485c0 <__do_global_dtors_aux>:
 80485c0: 80 3d 44 a0 04 08 00 cmpb   $0x0,0x804a044
 80485c7: 75 13                jne    80485dc <__do_global_dtors_aux+0x1c>
 80485c9: 55                    push   %ebp
 80485ca: 89 e5                mov    %esp,%ebp
 80485cc: 83 ec 08              sub    $0x8,%esp
 80485cf: e8 7c ff ff ff        call   8048550 <deregister_tm_clones>
 80485d4: c6 05 44 a0 04 08 01 movb   $0x1,0x804a044
 80485db: c9                    leave 
 80485dc: f3 c3                repz ret
 80485de: 66 90                xchg   %ax,%ax

080485e0 <frame_dummy>:
 80485e0: a1 08 9f 04 08        mov    0x8049f08,%eax
 80485e5: 85 c0                test   %eax,%eax
 80485e7: 74 1f                je     8048608 <frame_dummy+0x28>
 80485e9: b8 00 00 00 00        mov    $0x0,%eax
 80485ee: 85 c0                test   %eax,%eax
 80485f0: 74 16                je     8048608 <frame_dummy+0x28>
 80485f2: 55                    push   %ebp
 80485f3: 89 e5                mov    %esp,%ebp
 80485f5: 83 ec 18              sub    $0x18,%esp
 80485f8: c7 04 24 08 9f 04 08 movl   $0x8049f08,(%esp)
 80485ff: ff d0                call   *%eax
 8048601: c9                    leave 
 8048602: e9 79 ff ff ff        jmp    8048580 <register_tm_clones>
 8048607: 90                    nop
 8048608: e9 73 ff ff ff        jmp    8048580 <register_tm_clones>
 804860d: 66 90                xchg   %ax,%ax
 804860f: 90                    nop

08048610 <main>:
 8048610: 55                    push   %ebp
 8048611: 89 e5                mov    %esp,%ebp
 8048613: 83 e4 f0              and    $0xfffffff0,%esp
 8048616: 81 ec 30 04 00 00    sub    $0x430,%esp
 804861c: c7 84 24 2c 04 00 00 movl   $0x0,0x42c(%esp)
 8048623: 00 00 00 00
 8048627: c7 84 24 28 04 00 00 movl   $0x0,0x428(%esp)
 804862e: 00 00 00 00
 8048632: 83 7d 08 02          cmpl   $0x2,0x8(%ebp)
 8048636: 74 1f                je     8048657 <main+0x47>
 8048638: 8b 45 0c              mov    0xc(%ebp),%eax
 804863b: 8b 00                mov    (%eax),%eax
 804863d: 89 44 24 04          mov    %eax,0x4(%esp)
 8048641: c7 04 24 80 88 04 08 movl   $0x8048880,(%esp)
 8048648: e8 23 fe ff ff        call   8048470 <printf@plt>
 804864d: b8 01 00 00 00        mov    $0x1,%eax
 8048652: e9 8c 01 00 00        jmp    80487e3 <main+0x1d3>
 8048657: c7 44 24 08 00 04 00 movl   $0x400,0x8(%esp)
 804865e: 00
 804865f: c7 44 24 04 30 00 00 movl   $0x30,0x4(%esp)
 8048666: 00
 8048667: 8d 44 24 28          lea    0x28(%esp),%eax
 804866b: 89 04 24              mov    %eax,(%esp)
 804866e: e8 5d fe ff ff        call   80484d0 <memset@plt>
 8048673: c7 44 24 08 00 00 00 movl   $0x0,0x8(%esp)
 804867a: 00
 804867b: c7 44 24 04 01 00 00 movl   $0x1,0x4(%esp)
 8048682: 00
 8048683: c7 04 24 02 00 00 00 movl   $0x2,(%esp)
 804868a: e8 51 fe ff ff        call   80484e0 <socket@plt>
 804868f: 89 84 24 2c 04 00 00 mov    %eax,0x42c(%esp)
 8048696: 83 bc 24 2c 04 00 00 cmpl   $0x0,0x42c(%esp)
 804869d: 00
 804869e: 79 16                jns    80486b6 <main+0xa6>
 80486a0: c7 04 24 a0 88 04 08 movl   $0x80488a0,(%esp)
 80486a7: e8 f4 fd ff ff        call   80484a0 <puts@plt>
 80486ac: b8 01 00 00 00        mov    $0x1,%eax
 80486b1: e9 2d 01 00 00        jmp    80487e3 <main+0x1d3>
 80486b6: c7 44 24 08 10 00 00 movl   $0x10,0x8(%esp)
 80486bd: 00
 80486be: c7 44 24 04 30 00 00 movl   $0x30,0x4(%esp)
 80486c5: 00
 80486c6: 8d 44 24 18          lea    0x18(%esp),%eax
 80486ca: 89 04 24              mov    %eax,(%esp)
 80486cd: e8 fe fd ff ff        call   80484d0 <memset@plt>
 80486d2: 66 c7 44 24 18 02 00 movw   $0x2,0x18(%esp)
 80486d9: c7 04 24 88 13 00 00 movl   $0x1388,(%esp)
 80486e0: e8 ab fd ff ff        call   8048490 <htons@plt>
 80486e5: 66 89 44 24 1a        mov    %ax,0x1a(%esp)
 80486ea: 8b 45 0c              mov    0xc(%ebp),%eax
 80486ed: 83 c0 04              add    $0x4,%eax
 80486f0: 8b 00                mov    (%eax),%eax
 80486f2: 8d 54 24 18          lea    0x18(%esp),%edx
 80486f6: 83 c2 04              add    $0x4,%edx
 80486f9: 89 54 24 08          mov    %edx,0x8(%esp)
 80486fd: 89 44 24 04          mov    %eax,0x4(%esp)
 8048701: c7 04 24 02 00 00 00 movl   $0x2,(%esp)
 8048708: e8 73 fd ff ff        call   8048480 <inet_pton@plt>
 804870d: 85 c0                test   %eax,%eax
 804870f: 7f 16                jg     8048727 <main+0x117>
 8048711: c7 04 24 c3 88 04 08 movl   $0x80488c3,(%esp)
 8048718: e8 83 fd ff ff        call   80484a0 <puts@plt>
 804871d: b8 01 00 00 00        mov    $0x1,%eax
 8048722: e9 bc 00 00 00        jmp    80487e3 <main+0x1d3>
 8048727: c7 44 24 08 10 00 00 movl   $0x10,0x8(%esp)
 804872e: 00
 804872f: 8d 44 24 18          lea    0x18(%esp),%eax
 8048733: 89 44 24 04          mov    %eax,0x4(%esp)
 8048737: 8b 84 24 2c 04 00 00 mov    0x42c(%esp),%eax
 804873e: 89 04 24              mov    %eax,(%esp)
 8048741: e8 ba fd ff ff        call   8048500 <connect@plt>
 8048746: 85 c0                test   %eax,%eax
 8048748: 79 16                jns    8048760 <main+0x150>
 804874a: c7 04 24 dd 88 04 08 movl   $0x80488dd,(%esp)
 8048751: e8 4a fd ff ff        call   80484a0 <puts@plt>
 8048756: b8 01 00 00 00        mov    $0x1,%eax
 804875b: e9 83 00 00 00        jmp    80487e3 <main+0x1d3>
 8048760: eb 36                jmp    8048798 <main+0x188>
 8048762: 8d 54 24 28          lea    0x28(%esp),%edx
 8048766: 8b 84 24 28 04 00 00 mov    0x428(%esp),%eax
 804876d: 01 d0                add    %edx,%eax
 804876f: c6 00 00              movb   $0x0,(%eax)
 8048772: a1 40 a0 04 08        mov    0x804a040,%eax
 8048777: 89 44 24 04          mov    %eax,0x4(%esp)
 804877b: 8d 44 24 28          lea    0x28(%esp),%eax
 804877f: 89 04 24              mov    %eax,(%esp)
 8048782: e8 69 fd ff ff        call   80484f0 <fputs@plt>
 8048787: 83 f8 ff              cmp    $0xffffffff,%eax
 804878a: 75 0c                jne    8048798 <main+0x188>
 804878c: c7 04 24 f7 88 04 08 movl   $0x80488f7,(%esp)
 8048793: e8 08 fd ff ff        call   80484a0 <puts@plt>
 8048798: c7 44 24 08 ff 03 00 movl   $0x3ff,0x8(%esp)
 804879f: 00
 80487a0: 8d 44 24 28          lea    0x28(%esp),%eax
 80487a4: 89 44 24 04          mov    %eax,0x4(%esp)
 80487a8: 8b 84 24 2c 04 00 00 mov    0x42c(%esp),%eax
 80487af: 89 04 24              mov    %eax,(%esp)
 80487b2: e8 a9 fc ff ff        call   8048460 <read@plt>
 80487b7: 89 84 24 28 04 00 00 mov    %eax,0x428(%esp)
 80487be: 83 bc 24 28 04 00 00 cmpl   $0x0,0x428(%esp)
 80487c5: 00
 80487c6: 7f 9a                jg     8048762 <main+0x152>
 80487c8: 83 bc 24 28 04 00 00 cmpl   $0x0,0x428(%esp)
 80487cf: 00
 80487d0: 79 0c                jns    80487de <main+0x1ce>
 80487d2: c7 04 24 0d 89 04 08 movl   $0x804890d,(%esp)
 80487d9: e8 c2 fc ff ff        call   80484a0 <puts@plt>
 80487de: b8 00 00 00 00        mov    $0x0,%eax
 80487e3: c9                    leave 
 80487e4: c3                    ret   
 80487e5: 66 90                xchg   %ax,%ax
 80487e7: 66 90                xchg   %ax,%ax
 80487e9: 66 90                xchg   %ax,%ax
 80487eb: 66 90                xchg   %ax,%ax
 80487ed: 66 90                xchg   %ax,%ax
 80487ef: 90                    nop

080487f0 <__libc_csu_init>:
 80487f0: 55                    push   %ebp
 80487f1: 57                    push   %edi
 80487f2: 31 ff                xor    %edi,%edi
 80487f4: 56                    push   %esi
 80487f5: 53                    push   %ebx
 80487f6: e8 45 fd ff ff        call   8048540 <__x86.get_pc_thunk.bx>
 80487fb: 81 c3 05 18 00 00    add    $0x1805,%ebx
 8048801: 83 ec 1c              sub    $0x1c,%esp
 8048804: 8b 6c 24 30          mov    0x30(%esp),%ebp
 8048808: 8d b3 04 ff ff ff    lea    -0xfc(%ebx),%esi
 804880e: e8 11 fc ff ff        call   8048424 <_init>
 8048813: 8d 83 00 ff ff ff    lea    -0x100(%ebx),%eax
 8048819: 29 c6                sub    %eax,%esi
 804881b: c1 fe 02              sar    $0x2,%esi
 804881e: 85 f6                test   %esi,%esi
 8048820: 74 27                je     8048849 <__libc_csu_init+0x59>
 8048822: 8d b6 00 00 00 00    lea    0x0(%esi),%esi
 8048828: 8b 44 24 38          mov    0x38(%esp),%eax
 804882c: 89 2c 24              mov    %ebp,(%esp)
 804882f: 89 44 24 08          mov    %eax,0x8(%esp)
 8048833: 8b 44 24 34          mov    0x34(%esp),%eax
 8048837: 89 44 24 04          mov    %eax,0x4(%esp)
 804883b: ff 94 bb 00 ff ff ff call   *-0x100(%ebx,%edi,4)
 8048842: 83 c7 01              add    $0x1,%edi
 8048845: 39 f7                cmp    %esi,%edi
 8048847: 75 df                jne    8048828 <__libc_csu_init+0x38>
 8048849: 83 c4 1c              add    $0x1c,%esp
 804884c: 5b                    pop    %ebx
 804884d: 5e                    pop    %esi
 804884e: 5f                    pop    %edi
 804884f: 5d                    pop    %ebp
 8048850: c3                    ret   
 8048851: eb 0d                jmp    8048860 <__libc_csu_fini>
 8048853: 90                    nop
 8048854: 90                    nop
 8048855: 90                    nop
 8048856: 90                    nop
 8048857: 90                    nop
 8048858: 90                  nop
 8048859: 90                    nop
 804885a: 90                    nop
 804885b: 90                    nop
 804885c: 90                    nop
 804885d: 90                  nop
 804885e: 90                    nop
 804885f: 90                  nop

08048860 <__libc_csu_fini>:
 8048860: f3 c3                repz ret
 8048862: 66 90                xchg   %ax,%ax

Desensamblado de la sección .fini:

08048864 <_fini>:
 8048864: 53                    push   %ebx
 8048865: 83 ec 08              sub    $0x8,%esp
 8048868: e8 d3 fc ff ff        call   8048540 <__x86.get_pc_thunk.bx>
 804886d: 81 c3 93 17 00 00    add    $0x1793,%ebx
 8048873: 83 c4 08              add    $0x8,%esp
 8048876: 5b                    pop    %ebx
 8048877: c3                    ret

Como pueden ver el codigo es algo extenso pero esta como que dividido en partes y además contiene estos subtítulos

Desensamblado de la sección .plt
Desensamblado de la sección .text
Desensamblado de la sección .fini

Tambien hay que analizar estos para entender el programa??
En línea

MCKSys Argentina
Moderador Global
***
Desconectado Desconectado

Mensajes: 5.471


Diviértete crackeando, que para eso estamos!


Ver Perfil
Re: Desensamblado de un archivo binario
« Respuesta #1 en: 26 Noviembre 2014, 06:23 am »

Hola!

Por lo que veo, deberias empezar por:

Código
  1. 08048510 <_start>:
  2.  

Ahora, creo que sería mejor que cargaras el binario en IDA. Te ayudaría muchísimo...  ;)

Saludos!
En línea

MCKSys Argentina

"Si piensas que algo está bien sólo porque todo el mundo lo cree, no estás pensando."

dRak0

Desconectado Desconectado

Mensajes: 234


Ver Perfil WWW
Re: Desensamblado de un archivo binario
« Respuesta #2 en: 26 Noviembre 2014, 13:29 pm »

No tenes que descifrar nada , ¿solo seguir el codigo en ASM?.
A mi gusto lo desensamblaria en sintaxis intel y no At&t.
Como dice MCKSys Argentina , si queres que la lectura del codigo sea mas "linda" usa IDA.
Tambien lo podrias depurar con gdb y ir viendo que hace paso a paso(Suponiendo que no tenga ninguna tecnica anti-debugging , de tenerlo tendrias que romperla antes).

Saludos.
En línea

Omar_2013

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Re: Desensamblado de un archivo binario
« Respuesta #3 en: 26 Noviembre 2014, 19:43 pm »

Gracias por la aclaración, en especial a L0rDp3i que fue mas claro.
En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Traspaso de un archivo ascii a uno binario
Programación Visual Basic
yujape63 8 3,181 Último mensaje 16 Septiembre 2006, 00:28 am
por Castord
leer archivo BINARIO « 1 2 3 4 »
Programación Visual Basic
WestOn 37 20,797 Último mensaje 3 Octubre 2008, 18:22 pm
por WestOn
Listar archivo binario
Programación C/C++
Teby45 0 2,043 Último mensaje 17 Septiembre 2010, 21:31 pm
por Teby45
Leer archivo binario en Vbs
Scripting
kapo.damy 2 3,907 Último mensaje 14 Diciembre 2011, 04:51 am
por kapo.damy
recorrer archivo binario
Programación C/C++
m@o_614 3 2,850 Último mensaje 25 Octubre 2013, 17:59 pm
por rir3760
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines