sp-анализ застрял в бесконечном цикле - PullRequest
0 голосов
/ 30 апреля 2020

Я пытаюсь перевернуть динамическую c библиотеку ссылок, и у меня возникла проблема. Автоанализ никогда не завершает выдачу ошибки "sp-analysis failed". Я очень плохо знаком с реверсированием, но я нашел здесь похожие потоки, в которых говорится, что нужно включить указатель стека и изменить положительное значение на отрицательное, но мое значение уже было отрицательным, поэтому я не думал, что это проблема. Я также увидел, что подпрограмме может потребоваться вручную установить «конечный адрес» для инструкции retn, поэтому я попытался изменить конечный адрес подпрограммы на retn address + 1, равный 0x1800144FA. Произошло изменение, но затем конечный адрес сразу же изменился на исходный. После этого я попытался определить всю подпрограмму, но она продолжала анализировать один и тот же адрес снова и снова.

.text:0000000180014360
.text:0000000180014360     ; Attributes: bp-based frame fpd=30h
.text:0000000180014360
.text:0000000180014360     sub_180014360   proc near               ; CODE XREF: sub_180013A30+10C↑p
.text:0000000180014360                                             ; sub_180016F10+6C0↓p
.text:0000000180014360
.text:0000000180014360     var_50          = qword ptr -50h
.text:0000000180014360     var_40          = qword ptr -40h
.text:0000000180014360     var_38          = qword ptr -38h
.text:0000000180014360     arg_10          = qword ptr  20h
.text:0000000180014360
.text:0000000180014360 000                 push    rbp
.text:0000000180014361 008                 push    r15
.text:0000000180014363 010                 push    r14
.text:0000000180014365 018                 push    r12
.text:0000000180014367 020                 push    rsi
.text:0000000180014368 028                 push    rdi
.text:0000000180014369 030                 push    rbx
.text:000000018001436A 038                 sub     rsp, 40h        ; Integer Subtraction
.text:000000018001436E 078                 lea     rbp, [rsp+40h]  ; Load Effective Address
.text:0000000180014373 078                 mov     [rbp+30h+var_38], 0FFFFFFFFFFFFFFFEh
.text:000000018001437B 078                 mov     r14, r8
.text:000000018001437E 078                 mov     r15, rdx
.text:0000000180014381 078                 mov     rsi, rcx
.text:0000000180014384 078                 movaps  xmm0, cs:xmmword_180420B10 ; Move Aligned Four Packed Single-FP
.text:000000018001438B 078                 movups  xmmword ptr [rcx+10h], xmm0 ; Move Unaligned Four Packed Single-FP
.text:000000018001438F 078                 mov     byte ptr [rcx], 0
.text:0000000180014392 078                 mov     rcx, rdx
.text:0000000180014395 078                 call    strlen          ; Call Procedure
.text:000000018001439A 078                 add     rax, [r14+10h]  ; Add
.text:000000018001439E 078                 mov     edi, 0Fh
.text:00000001800143A3 078                 cmp     rax, 10h        ; Compare Two Operands
.text:00000001800143A7 078                 mov     [rbp+30h+var_40], rsi
.text:00000001800143AB 078                 jb      short loc_1800143C8 ; Jump if Below (CF=1)
.text:00000001800143AB     ; ---------------------------------------------------------------------------
.text:00000001800143AD 078                 db  48h ; H
.text:00000001800143AE     ; ---------------------------------------------------------------------------
.text:00000001800143AE 078                 mov     ecx, esi
.text:00000001800143B0 078                 mov     rdx, rax
.text:00000001800143B3 078                 call    sub_180014670   ; Call Procedure
.text:00000001800143B8 078                 mov     rsi, [rbp+30h+var_40]
.text:00000001800143BC 078                 mov     qword ptr [rsi+10h], 0
.text:00000001800143C4 078                 mov     rdi, [rsi+18h]
.text:00000001800143C8
.text:00000001800143C8     loc_1800143C8:                          ; CODE XREF: sub_180014360+4B↑j
.text:00000001800143C8 078                 mov     rcx, r15
.text:00000001800143CB 078                 call    strlen          ; Call Procedure
.text:00000001800143D0 078                 mov     rbx, rax
.text:00000001800143D3 078                 cmp     rdi, rax        ; Compare Two Operands
.text:00000001800143D6 078                 jnb     short near ptr loc_1800143EC+1 ; Jump if Not Below (CF=0)
.text:00000001800143D8 078                 mov     [rsp+70h+var_50], rbx
.text:00000001800143DD 078                 mov     rcx, rsi
.text:00000001800143E0 078                 mov     rdx, rbx
.text:00000001800143E3 078                 mov     r9, r15
.text:00000001800143E6 078                 call    sub_180014030   ; Call Procedure
.text:00000001800143E6     ; ---------------------------------------------------------------------------
.text:00000001800143EB 078                 db 0EBh ; ë
.text:00000001800143EC     ; ---------------------------------------------------------------------------
.text:00000001800143EC
.text:00000001800143EC     loc_1800143EC:                          ; CODE XREF: sub_180014360+76↑j
.text:00000001800143EC 078                 and     ecx, [rax-77h]  ; Logical AND
.text:00000001800143EF 078                 pop     rsi
.text:00000001800143F0 070                 adc     [rcx-77h], cl   ; Add with Carry
.text:00000001800143F3 070                 hlt                     ; Halt
.text:00000001800143F3     ; ---------------------------------------------------------------------------
.text:00000001800143F4 070                 db  48h ; H
.text:00000001800143F5 070                 db  83h ; ƒ
.text:00000001800143F6 070                 db 0FFh ; ÿ
.text:00000001800143F7 070                 db  0Fh
.text:00000001800143F8 070                 db  76h ; v
.text:00000001800143F9 070                 db    3
.text:00000001800143FA 070                 db  4Ch ; L
.text:00000001800143FB 070                 db  8Bh ; ‹
.text:00000001800143FC 070                 db  26h ; &
.text:00000001800143FD 070                 db  4Ch ; L
.text:00000001800143FE 070                 db  89h ; ‰
.text:00000001800143FF 070                 db 0E1h ; á
.text:0000000180014400 070                 db  4Ch ; L
.text:0000000180014401 070                 db  89h ; ‰
.text:0000000180014402 070                 db 0FAh ; ú
.text:0000000180014403 070                 db  49h ; I
.text:0000000180014404 070                 db  89h ; ‰
.text:0000000180014405 070                 db 0D8h ; Ø
.text:0000000180014406 070                 db 0E8h ; è
.text:0000000180014407 070                 db  55h ; U
.text:0000000180014408 070                 db  6Bh ; k
.text:0000000180014409 070                 db  40h ; @
.text:000000018001440A 070                 db    0
.text:000000018001440B 070                 db  41h ; A
.text:000000018001440C 070                 db 0C6h ; Æ
.text:000000018001440D 070                 db    4
.text:000000018001440E 070                 db  1Ch
.text:000000018001440F 070                 db    0
.text:0000000180014410 070                 db  4Dh ; M
.text:0000000180014411 070                 db  8Bh ; ‹
.text:0000000180014412 070                 db  46h ; F
.text:0000000180014413 070                 db  10h
.text:0000000180014414 070                 db  49h ; I
.text:0000000180014415 070                 db  83h ; ƒ
.text:0000000180014416 070                 db  7Eh ; ~
.text:0000000180014417 070                 db  18h
.text:0000000180014418 070                 db  0Fh
.text:0000000180014419 070                 db  76h ; v
.text:000000018001441A 070                 db    3
.text:000000018001441B 070                 db  4Dh ; M
.text:000000018001441C 070                 db  8Bh ; ‹
.text:000000018001441D 070                 db  36h ; 6
.text:000000018001441E 070                 db  48h ; H
.text:000000018001441F 070                 db  8Bh ; ‹
.text:0000000180014420 070                 db  7Dh ; }
.text:0000000180014421 070                 db 0F0h ; ð
.text:0000000180014422 070                 db  48h ; H
.text:0000000180014423 070                 db  8Bh ; ‹
.text:0000000180014424 070                 db  4Fh ; O
.text:0000000180014425 070                 db  10h
.text:0000000180014426 070                 db  48h ; H
.text:0000000180014427 070                 db  8Bh ; ‹
.text:0000000180014428 070                 db  47h ; G
.text:0000000180014429 070                 db  18h
.text:000000018001442A 070                 db  48h ; H
.text:000000018001442B 070                 db  89h ; ‰
.text:000000018001442C 070                 db 0C2h ; Â
.text:000000018001442D 070                 db  48h ; H
.text:000000018001442E 070                 db  29h ; )
.text:000000018001442F 070                 db 0CAh ; Ê
.text:0000000180014430 070                 db  4Ch ; L
.text:0000000180014431 070                 db  39h ; 9
.text:0000000180014432 070                 db 0C2h ; Â
.text:0000000180014433 070                 db  73h ; s
.text:0000000180014434 070                 db  15h
.text:0000000180014435 070                 db  4Ch ; L
.text:0000000180014436     ; ---------------------------------------------------------------------------
.text:0000000180014436 070                 mov     [rsp+20h], eax
.text:000000018001443A 070                 mov     rcx, rdi
.text:000000018001443D 070                 mov     rdx, r8
.text:0000000180014440 070                 mov     r9, r14
.text:0000000180014443 070                 call    sub_180014030   ; Call Procedure
.text:0000000180014443     ; ---------------------------------------------------------------------------
.text:0000000180014448 070                 db 0EBh ; ë
.text:0000000180014449     ; ---------------------------------------------------------------------------
.text:0000000180014449 070                 and     ecx, [rdx-73h]  ; Logical AND
.text:000000018001444C 070                 xor     al, 1           ; Logical Exclusive OR
.text:000000018001444E 070                 mov     [rdi+10h], rsi
.text:0000000180014452 070                 mov     rbx, rdi
.text:0000000180014455 070                 cmp     rax, 0Fh        ; Compare Two Operands
.text:0000000180014459 070                 jbe     short loc_18001445E ; Jump if Below or Equal (CF=1 | ZF=1)
.text:000000018001445B 070                 mov     rbx, [rdi]
.text:000000018001445E
.text:000000018001445E     loc_18001445E:                          ; CODE XREF: sub_180014360+F9↑j
.text:000000018001445E 070                 add     rcx, rbx        ; Add
.text:0000000180014461 070                 mov     rdx, r14
.text:0000000180014464 070                 call    memmove         ; Call Procedure
.text:0000000180014469 070                 mov     byte ptr [rbx+rsi], 0
.text:000000018001446D 070                 mov     rax, [rbp+30h+var_40]
.text:0000000180014471 070                 add     rsp, 40h        ; Add
.text:0000000180014475 030                 pop     rbx
.text:0000000180014476 028                 pop     rdi
.text:0000000180014477 020                 pop     rsi
.text:0000000180014478 018                 pop     r12
.text:000000018001447A 010                 pop     r14
.text:000000018001447C 008                 pop     r15
.text:000000018001447E 000                 pop     rbp
.text:000000018001447F -08                 retn                    ; Return Near from Procedure
.text:0000000180014480     ; ---------------------------------------------------------------------------
.text:0000000180014480
.text:0000000180014480     loc_180014480:
.text:0000000180014480 -08                 mov     [rsp-10h+arg_10], rdx
.text:0000000180014485 -08                 push    rbp
.text:0000000180014486 000                 push    r15
.text:0000000180014488 008                 push    r14
.text:000000018001448A 010                 push    r12
.text:000000018001448C 018                 push    rsi
.text:000000018001448D 020                 push    rdi
.text:000000018001448E 028                 push    rbx
.text:000000018001448F 030                 sub     rsp, 30h        ; Integer Subtraction
.text:0000000180014493 060                 lea     rbp, [rdx+40h]  ; Load Effective Address
.text:0000000180014497 060                 mov     rax, [rbp+30h+var_40]
.text:000000018001449B 060                 mov     rax, [rax+18h]
.text:000000018001449F 060                 cmp     rax, 10h        ; Compare Two Operands
.text:00000001800144A3 060                 jb      short loc_1800144D9 ; Jump if Below (CF=1)
.text:00000001800144A5 060                 mov     rcx, [rbp+30h+var_40]
.text:00000001800144A9 060                 mov     rcx, [rcx]
.text:00000001800144AC 060                 lea     rdx, [rax+1]    ; Load Effective Address
.text:00000001800144B0 060                 cmp     rdx, 1000h      ; Compare Two Operands
.text:00000001800144B7 060                 jb      short loc_1800144D4 ; Jump if Below (CF=1)
.text:00000001800144B9 060                 mov     rbx, [rcx-8]
.text:00000001800144BD 060                 add     rcx, 0FFFFFFFFFFFFFFF8h ; Add
.text:00000001800144C1 060                 sub     rcx, rbx        ; Integer Subtraction
.text:00000001800144C4 060                 cmp     rcx, 20h        ; Compare Two Operands
.text:00000001800144C8 060                 jnb     short loc_1800144FA ; Jump if Not Below (CF=0)
.text:00000001800144CA 060                 add     rax, 28h        ; Add
.text:00000001800144CE 060                 mov     rdx, rax
.text:00000001800144D1 060                 mov     rcx, rbx
.text:00000001800144D4
.text:00000001800144D4     loc_1800144D4:                          ; CODE XREF: sub_180014360+157↑j
.text:00000001800144D4 060                 call    j_j_free        ; Call Procedure
.text:00000001800144D9
.text:00000001800144D9     loc_1800144D9:                          ; CODE XREF: sub_180014360+143↑j
.text:00000001800144D9 060                 mov     rax, [rbp+30h+var_40]
.text:00000001800144DD 060                 movaps  xmm0, cs:xmmword_180420B10 ; Move Aligned Four Packed Single-FP
.text:00000001800144E4 060                 movups  xmmword ptr [rax+10h], xmm0 ; Move Unaligned Four Packed Single-FP
.text:00000001800144E8 060                 mov     byte ptr [rax], 0
.text:00000001800144EB 060                 add     rsp, 30h        ; Add
.text:00000001800144EF 030                 pop     rbx
.text:00000001800144F0 028                 pop     rdi
.text:00000001800144F1 020                 pop     rsi
.text:00000001800144F2 018                 pop     r12
.text:00000001800144F4 010                 pop     r14
.text:00000001800144F6 008                 pop     r15
.text:00000001800144F8 000                 pop     rbp
.text:00000001800144F9 -08                 retn                    ; Return Near from Procedure
.text:00000001800144FA     ; ---------------------------------------------------------------------------
.text:00000001800144FA
.text:00000001800144FA     loc_1800144FA:                          ; CODE XREF: sub_180014360+168↑j
.text:00000001800144FA 060                 call    cs:_invalid_parameter_noinfo_noreturn ; Indirect Call Near Procedure
.text:00000001800144FA     sub_180014360   endp ; sp-analysis failed
.text:00000001800144FA
.text:00000001800144FA     ; ---------------------------------------------------------------------------
.text:0000000180014500                     db 0CCh
.text:0000000180014501                     db 0CCh ; Ì
.text:0000000180014502                     db 0CCh ; Ì
.text:0000000180014503                     db 0CCh ; Ì
.text:0000000180014504                     db 0CCh ; Ì
.text:0000000180014505                     db 0CCh ; Ì
.text:0000000180014506                     db 0CCh ; Ì
.text:0000000180014507                     db 0CCh ; Ì
.text:0000000180014508                     db 0CCh ; Ì
.text:0000000180014509                     db 0CCh ; Ì
.text:000000018001450A                     db 0CCh ; Ì
.text:000000018001450B                     db 0CCh ; Ì
.text:000000018001450C                     db 0CCh ; Ì
.text:000000018001450D                     db 0CCh ; Ì
.text:000000018001450E                     db 0CCh ; Ì
.text:000000018001450F                     db 0CCh ; Ì
...