Skip to content
KitploitKITPLOIT
도구블로그
제출
도구블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

··피드·문의·개인정보·© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
CVE-2023-20938 — CVE-2023-20938에 대한 기술적 분석 및 개념 증명(PoC) 익스플로잇으로, Android 커널의 Binder 드라이버에서 발생하는 use-after-free 취약점을 활용해 로컬 권한 상승을 가능하게 합니다. | Kitploit
도구/GitHubGitHub/jaf0rk/cve-2023-20938
Android SecurityVulnerability AnalysisExploitationBinary Exploitation
GitHubjaf0rk/cve-2023-20938

CVE-2023-20938

CVE-2023-20938에 대한 기술적 분석 및 개념 증명(PoC) 익스플로잇으로, Android 커널의 Binder 드라이버에서 발생하는 use-after-free 취약점을 활용해 로컬 권한 상승을 가능하게 합니다.

저장소 보기
13754개월 전아직 검토되지 않음

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →
공유

CVE-2023-20938

English

취약점 분석

  1. 클라이언트 A와 클라이언트 B가 컨텍스트 매니저 servicemanager를 통해 Binder 연결을 설정합니다.
  2. A가 node 0xbeef를 생성하고(node = binder_new_node(proc, fp);), B는 ref->target_node를 통해 node 0xbeef를 참조합니다.
  3. B가 먼저 target_node 0xbeef를 올바르게 처리하여 target_node 0xbeef를 참조하는 트랜잭션 binder_transaction을 A의 트랜잭션 큐에 저장합니다(binder_enqueue_work_ilocked(&t->work, &proc->todo);). 이로 인해 A는 해제된 댕글링 포인터를 다시 참조할 수 있습니다.
  4. B가 정렬되지 않은 offsets_size로 오류 처리 코드에 진입하고(IS_ALIGNED(tr->offsets_size, sizeof(binder_size_t))), 아직 0인 buffer_offset이 binder_transaction_buffer_release 함수에 전달되어 취약점을 트리거합니다.
  5. binder_transaction_buffer_release 함수는 binder_dec_node를 통해 binder_dec_node_nilocked 함수를 호출하여 node 0xbeef의 local_strong_refs 참조 카운터를 감소시킵니다. 그러나 node 인스턴스에는 여러 참조 카운터와 참조 목록이 있으며, 이러한 카운터가 모두 0이 되어야 해제가 트리거됩니다.
  6. B의 binder를 닫으면 binder_cleanup_ref_olocked 함수가 트리거됩니다. 이때 binder_dec_node_nilocked도 다시 호출되는데, binder_dec_node_nilocked가 true를 반환하면 node(0xbeef)를 가리키는 포인터 ref->node를 비우지 않습니다.
  7. 이후 binder_free_ref가 호출되며, binder_free_ref 함수에서 node 0xbeef가 해제됩니다.
  8. A는 binder_thread_read 함수에서 해제된 node 0xbeef를 다시 참조하게 됩니다.

추가 설명: 실제 Android 환경에서 일반 앱 권한으로는 servicemanager를 통해 서비스를 등록할 수 없지만, ITokenManager를 사용하여 두 프로세스 간의 연결을 구현할 수 있습니다. 본 테스트 케이스는 ITokenManager를 사용했습니다.

설명

  1. Makefile: make 파일로, 내부의 출력 디렉터리를 수정할 수 있습니다.
  2. Cuttlefish 에뮬레이터 설정
  3. 커널 환경 컴파일: 취약점을 트리거한 커널 환경 버전은 android12-5.10.136_r00이며, 하드웨어 아키텍처는 x86_64를 사용합니다.
root@kitploit:~
commit ee965fe12def46132d0087a9f353750d717e717c (HEAD -> android12-5.10.136_r00, tag: android12-5.10.136_r00)
Merge: b7247246f637 fb39cdb9eac1
Author: Greg Kroah-Hartman <[email protected]>
Date:   Tue Aug 16 12:45:36 2022 +0200
  1. Android 에뮬레이터에서 aapk를 실행하면 다음과 같은 KASAN 크래시 로그가 표시됩니다.
root@kitploit:~
[   43.177167] ==================================================================
[   43.178189] BUG: KASAN: use-after-free in binder_ioctl+0x48de/0x50b0
[   43.178438] Read of size 8 at addr ffff888116e99d58 by task poc/89
[   43.178646] 
[   43.179102] CPU: 0 PID: 89 Comm: poc Not tainted 5.4.219 #1
[   43.179309] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
[   43.179766] Call Trace:
[   43.180332]  dump_stack+0x76/0x9c
[   43.180514]  ? binder_ioctl+0x48de/0x50b0
[   43.180738]  print_address_description.constprop.0+0x16/0x200
[   43.180962]  ? binder_ioctl+0x48de/0x50b0
[   43.181131]  ? binder_ioctl+0x48de/0x50b0
[   43.181303]  __kasan_report.cold+0x1d/0x35
[   43.181464]  ? binder_ioctl+0x48de/0x50b0
[   43.181626]  kasan_report+0x10/0x20
[   43.181761]  binder_ioctl+0x48de/0x50b0
[   43.181966]  ? switch_mm_irqs_off+0x388/0xd80
[   43.182127]  ? __switch_to_asm+0x42/0x80
[   43.182250]  ? binder_thread_write+0x2070/0x2070
[   43.182392]  ? __schedule+0x71b/0x18b0
[   43.182513]  ? io_schedule_timeout+0x150/0x150
[   43.182660]  ? hrtimer_start_range_ns+0x635/0xc10
[   43.182803]  ? wait_woken+0x1c0/0x1c0
[   43.182944]  ? hrtimer_try_to_cancel+0x19/0x3f0
[   43.183092]  ? do_nanosleep+0x246/0x4c0
[   43.183218]  ? schedule_timeout_idle+0x50/0x50
[   43.183363]  ? _raw_spin_unlock_irqrestore+0x36/0x70
[   43.183519]  ? memset+0x20/0x40
[   43.183632]  do_vfs_ioctl+0x91e/0xef0
[   43.183759]  ? selinux_file_ioctl+0x36f/0x510
[   43.183896]  ? ioctl_preallocate+0x1a0/0x1a0
[   43.184034]  ? selinux_bprm_set_creds+0xcb0/0xcb0
[   43.184182]  ? memset+0x20/0x40
[   43.184289]  ? __rseq_handle_notify_resume+0x61d/0xb10
[   43.184458]  ? __x64_sys_rseq+0x4f0/0x4f0
[   43.184600]  ? security_file_ioctl+0x4b/0x90
[   43.184742]  ksys_ioctl+0x59/0x90
[   43.184853]  ? switch_fpu_return+0xc2/0x210
[   43.184987]  __x64_sys_ioctl+0x69/0xa0
[   43.185112]  ? prepare_exit_to_usermode+0x231/0x2c0
[   43.185260]  do_syscall_64+0x87/0x140
[   43.185384]  entry_SYSCALL_64_after_hwframe+0x5c/0xc1
[   43.185665] 
[   43.185836] Allocated by task 89:
[   43.186060]  save_stack+0x1b/0x80
[   43.186211]  __kasan_kmalloc.constprop.0+0xc2/0xd0
[   43.186380]  binder_new_node+0x49/0x870
[   43.186519]  binder_transaction+0x4002/0x5d20
[   43.186669]  binder_thread_write+0x454/0x2070
[   43.186816]  binder_ioctl+0xff9/0x50b0
[   43.186950]  do_vfs_ioctl+0x91e/0xef0
[   43.187070]  ksys_ioctl+0x59/0x90
[   43.187177]  __x64_sys_ioctl+0x69/0xa0
[   43.187296]  do_syscall_64+0x87/0x140
[   43.187419]  entry_SYSCALL_64_after_hwframe+0x5c/0xc1
[   43.187628] 
[   43.187760] Freed by task 67:
[   43.187921]  save_stack+0x1b/0x80
[   43.188082]  __kasan_slab_free+0x12e/0x170
[   43.188286]  kfree+0x90/0x250
[   43.188485]  binder_deferred_func+0xba6/0x1040
[   43.188777]  process_one_work+0x6fe/0x1250
[   43.188989]  worker_thread+0x534/0x1200
[   43.189156]  kthread+0x314/0x3e0
[   43.189278]  ret_from_fork+0x35/0x40
[   43.189412] 
[   43.189509] The buggy address belongs to the object at ffff888116e99d00
[   43.189509]  which belongs to the cache kmalloc-128 of size 128
[   43.190587] The buggy address is located 88 bytes inside of
[   43.190587]  128-byte region [ffff888116e99d00, ffff888116e99d80)
[   43.191116] The buggy address belongs to the page:
[   43.191529] page:ffffea00045ba640 refcount:1 mapcount:0 mapping:ffff88811a801480 index:0x0
[   43.192177] flags: 0x200000000000200(slab)
[   43.192678] raw: 0200000000000200 dead000000000100 dead000000000122 ffff88811a801480
[   43.192969] raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
[   43.193251] page dumped because: kasan: bad access detected
[   43.193438] 
[   43.193518] Memory state around the buggy address:
[   43.193928]  ffff888116e99c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   43.194205]  ffff888116e99c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   43.194434] >ffff888116e99d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   43.194728]                                                     ^
[   43.194976]  ffff888116e99d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[   43.195291]  ffff888116e99e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[   43.195653] ==================================================================
[   43.196033] Disabling lock debugging due to kernel taint
[   43.197301] binder: release 89:89 transaction 12 in, still active
[   43.197576] binder: release 89:89 transaction 9 out, still active
[   43.198094] binder: send failed reply for transaction 12, target dead
[   43.198392] binder: send failed reply for transaction 9, target dead

TODO: exploit 작성 중...

도구 다운로드