Notice
Recent Posts
Recent Comments
Link
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

cdor1's lab

ARM architecture 본문

Security/Pwnable

ARM architecture

Cdor1 2016. 9. 26. 01:00

-레지스터-

 16개 범용 레지스터 

   r0~r12 -연산명령과 같은 범용

   r13(sp), r14(lr), r15(pc), cpsr - 특수 목적(연산에서 사용)

  1개의 cpsr

  privilege 모드의 경우 각각 1개의 spsr

r13(sp 스택)

r14(lr 함수 호출시 복귀할 주소)

r15(pc 수행할 위치 저장)

CPSR(1개의 프로세서가 수행하고 있는 현재의 동작 상태)

SPSR(이전 모드의 CPSR 복사본)


(모드마다 사용되는 레지스터의 수가 다름)


-모드-

User : Normal Program execution mode(노말 모드(프로그램 실행시))

System : Run privileged operating system tasks(권한이 필요한 경우)

FIQ : When a high priority (fast) interrupt is raised(우선 순위 예외처리 사용시)

IRQ : When a low priority (normal) interrupt is raised(보통 순위 예외처리 사용시)

Supervisor : A protected mode for the operating system, entered when a SWI instruction is executed

(SWI instruction이 실행될 때, 사용되는 보호된 Operating system mode)

Abort : Used to handle memory access violations(인가되지 않은 메모리 접근시)

Undef : Used to handle undefined instructions(정의되지않은 명령어 사용시)

User 모드를 제외한 나머지 모드들은 Privileged Mode이고 User 모드만 Normal Mode이다.

 Privileged Mode 끼리는 모드를 옮겨다닐 수 있지만 Normal Mode는 Privileged Mode로 옮겨다니지 못한다.


-어셈블리-

http://egloos.zum.com/recipes/v/5027277


-Exploit-

x86_x64에서 익스플로잇 하듯이 eip대신에 pc를 건들여주면 된다.

인자 처리를 스택으로 하지 않고 r0~r12레지스터들로 처리하니 이 점에 유의해서 익스플로잇 하면 되겠다.

arm에서도 x86_x64와 같이 No-eXecutable 비트가 적용될 수 있어 ret2zp라는 기법을 사용한다.

x86_x64에서 사용되는 rtl, rop정도로 이해하면 되는데, 가젯을 자유자재로 다뤄 익스플로잇하는 방식이다.








'Security > Pwnable' 카테고리의 다른 글

how2heap 번역본  (0) 2016.11.03
YISF2016 Final pwnable  (2) 2016.10.01
pwnable.kr unexploitable  (0) 2016.09.24
Codegate 2015 bookstore  (0) 2016.09.21
Defcon23 Quals r0pbaby  (0) 2016.09.19
Comments