728x90

[๋ฌธ์ œ]

https://tryhackme.com/r/room/windowsforensics1

 

Windows Forensics 1

Introduction to Windows Registry Forensics

tryhackme.com


[๋ฌธ์ œ ํ’€์ด]

Task 1) Introduction to Computer Forensics for Windows

 

What is the most used Desktop Operationg System right now?

๋‹ต) Microsoft Windows


Task 2) Windows Registry and Forensics

What is the short form for HKEY_LOCAL_MACHINE?

๋‹ต) HKLM


Task3) Accessing registry hives offline

What is the path for the five main registry hives, DEFAULT, SAM, SECURITY, SOFTWARE, and SYSTEM?

๋‹ต) C:\Windows\System32\Config

 

What is the path for the AmCache hive?

๋‹ต) C:\Windows\AppCompat\Programs\Amcache.hve


Task 6) System Information and System Accounts

What is the Current Build Number of the machine whose data is being investigated?

๋‹ต: 19044

 

 

Which ControlSet contains the last known good configuration?

๋‹ต: 1

 

What is the Computer Name of the computer?

๋‹ต: THM-4N6

 

What is the value of the TimeZoneKeyName?

๋‹ต: Pakistan Standard Time

 

What is the DHCP IP address

๋‹ต: 192.168.100.58

What is the RID of the Guest User account?

๋‹ต: 501


Task 7) Usage or knowledge of files/folders

When was EZtools opened?

๋‹ต: 2021-15-01 13:00:34

At what time was My Computer last interacted with?

๋‹ต: 2021-12-01 13:06:47

What is the Absolute Path of the file opened using notepad.exe?

๋‹ต: C:\Program Files\Amazon\Ec2ConfigService\Settings

 

When was this file opened?

๋‹ต: 2021-11-30 10:56:19


Task 8) Evidence of Execution

How many times was the File Explorer launched?

๋‹ต: 26

 

What is another name for ShimCache?

๋‹ต: AppCompatCache

 

Which of the artifacts also saves SHA1 hashes of the executed programs?

๋‹ต: AmCache

 

Which of the artifacts saves the full path of the executed programs?

๋‹ต: BAM/DAM


Task 9) External Devices/USB device forensics

What is the serial number of the device from the manufacturer 'Kingston'?

๋‹ต: 1C6f654E59A3B0C179D366AE&0

 

What is the name of this device?

๋‹ต: Kingston Data Traveler 2.0 USB Device

 

 

What is the friendly name of the device from the manufacturer 'Kingston'?

๋‹ต: USB


Task 10) Hands-on Challenge

  • ๋จผ์ € RegistryExplorer์„ run as administrator๋กœ ํ•ด์„œ ์‹คํ–‰ํ•œ๋‹ค.
  • ๊ทธ๋‹ค์Œ C:\Windows\System32\Config ๋””๋ ‰ํ„ฐ๋ฆฌ์—์„œ SAM, SOFTWARE, SYSTEM์„ ๋กœ๋“œํ•ด์•ผ ํ•œ๋‹ค.
  • SOFTWARE๋ž‘ SYSTEM์„ ๋กœ๋“œ๋ฅผ ํ•˜๋ผ๊ณ  ํ•˜๋ฉด "Dirty hive detected" ํŒ์—…์ด ๋œจ๋ฉด "no"๋ฅผ ์„ ํƒํ•˜๊ณ  "replay transaction logs against this hive" ํŒ์—…์ด ๋œจ๋ฉด "yes"๋ฅผ ์„ ํƒํ•œ๋‹ค.

  • ๊ทธ๋‹ค์Œ 1~3๋ฒˆ ๋ฌธ์ œ๋ฅผ ํ’€๊ธฐ ์œ„ํ•ด SAM์—์„œ Users ๊ฒฝ๋กœ๋ฅผ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

How many user create accounts are present on the system?

๋‹ต: 3

 

What is the username of the account that has never been logged in?

๋‹ต:  thm-user2

 

What's the password hint for the user THM-4n6?

๋‹ต: count

 

์•„๋ž˜ ๋ฌธ์ œ๋“ค์€ ๋‹ค์Œ์— ์ด์–ด์„œ...

When was the file 'Changelog.txt' accessed?

What is the complete path from where the python 3.8.2 installer was run?

When was the USB device with the friendly name 'USB' last connected?

 

์ฐธ๊ณ 

728x90

[๋ฌธ์ œ]

https://los.rubiya.kr/

 

Lord of SQLInjection

 

los.rubiya.kr


[๋ฌธ์ œํ’€์ด]

  • ๋จผ์ € ์ฑ—gpt๋ฅผ ์ด์šฉํ•ด ์ฝ”๋“œ๋ฅผ ๋ถ„์„ํ•œ ๊ฒฐ๊ณผ ์กฐํšŒํ•œ query์˜ ๊ฒฐ๊ณผ์— id๊ฐ€ ์žˆ๋‹ค๋ฉด ์„ฑ๊ณต์„ ์ถœ๋ ฅํ•˜๋Š” ๊ฒƒ์„ ์•Œ์•˜๊ณ  $_GET['id']์™€ $_GET['pw']๋ฅผ ๊ทธ๋Œ€๋กœ ์ฟผ๋ฆฌ์— ๋„ฃ๊ณ  ์žˆ์œผ๋ฏ€๋กœ, ์ด๋ฅผ ์ด์šฉํ•˜์—ฌ ๊ณต๊ฒฉ์„ ์‹œ๋„ํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ์•˜์Šต๋‹ˆ๋‹ค.



  • ๊ทธ๋ž˜์„œ query๋ฌธ์„ php?id=admin&pw=admin ๋ณ€๊ฒฝํ•˜๋ฉด ๋˜์ง€ ์•Š์„๊นŒ ์ƒ๊ฐํ•˜๊ณ  ๋ณ€๊ฒฝํ•œ ๊ฒฐ๊ณผ ๋ฌธ์ œ๊ฐ€ ํ•ด๊ฒฐ๋˜์ง€ ์•Š์•„ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์„ ์ฐพ์•„๋ดค์Šต๋‹ˆ๋‹ค.

 

  • SQL ์‚ฝ์ž… ๊ณต๊ฒฉ ์ค‘ ๊ฐ€์žฅ ์ผ๋ฐ˜์ ์ธ ‘ or ‘1’=’1 ๋ฐฉ๋ฒ•์„ ์‹œ๋„ํ•˜์—ฌ ํ•ญ์ƒ ์ฐธ์ธ ์กฐ๊ฑด์„ ๋งŒ๋“ค์–ด ๋ชจ๋“  ๋ ˆ์ฝ”๋“œ๋ฅผ ๊ฐ€์ ธ์˜ค๊ฒŒ ํ•˜๋ ค๊ณ  ?id=' OR '1'='1&pw=' OR '1'='1๋กœ query๋ฌธ์„ ๋ณ€๊ฒฝํ–ˆ๊ณ  ๊ทธ ๊ฒฐ๊ณผ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.

 


 

[TIP]

  • Get๋ฐฉ์‹์€ ์ฃผ์†Œ์ฐฝ์— ๊ฐ’์„ ์ž…๋ ฅ, ์ถœ๋ ฅํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ฃผ์†Œ์ฐฝ์˜ ๋ณ€์ˆ˜๊ฐ’์„ ์ˆ˜์ •ํ•œ๋‹ค๋ฉด ๋“ค์–ด๊ฐ€๊ฑฐ๋‚˜ ๋‚˜์˜ค๋Š” ๊ฐ’์— ์˜ํ–ฅ์„ ๋ฏธ์นœ๋‹ค.
  • url์— ๋ณ€์ˆ˜๊ฐ’์„ ์ˆ˜์ •ํ•  ๋•Œ์—๋Š” php๋’ค์— ?(๋ณ€์ˆ˜๋ช…)/๋ณ€์ˆ˜ ์ž…๋ ฅ ๋‹ค๋ฅธ ๋ณ€์ˆ˜๋ฅผ ๋˜ ์ž…๋ ฅํ•˜๊ณ ์ž ํ•  ๋•Œ php?(๋ณ€์ˆ˜๋ช…)&(๋ณ€์ˆ˜๋ช…)
  • ์ฟผ๋ฆฌ ์ „์ฒด๋ฅผ ์ฐธ์œผ๋กœ ๋งŒ๋“ค์–ด์ฃผ๋Š” ๋ฐฉ๋ฒ•: ‘1’ or ‘1’=1

 

[์ฐธ๊ณ ]

https://in-reason.tistory.com/26

 

 

'๋ณด์•ˆ > CTF' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[์›นํ•ดํ‚น] | [LOS] Goblin write up  (0) 2024.12.01
[์›นํ•ดํ‚น] | [LOS] Cobolt write up  (0) 2024.12.01
[Tryhackme] OhSINT  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Meta  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Browser Forensics - Cryptominer  (0) 2024.11.24
728x90

[๋ฌธ์ œ]

https://los.rubiya.kr/chall/goblin_e5afb87a6716708e3af46a849517afdc.php

 

https://los.rubiya.kr/chall/goblin_e5afb87a6716708e3af46a849517afdc.php

 

los.rubiya.kr


[๋ฌธ์ œ ํ’€์ด]

  $query = "select id from prob_goblin where id='guest' and no={$_GET[no]}";
  • ์šฐ์„  ์ „ ๋ฌธ์ œ๋“ค๊ณผ ๋‹ค๋ฅด๊ฒŒ id๊ฐ€ ๊ณ ์ •๋˜์–ด ์žˆ๊ณ  ์ด๋ฒˆ์—๋Š” no ๋ถ€๋ถ„์„ ์ž…๋ ฅํ•ด์•ผ ํ•˜๋Š” ๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค.
  • no๋Š” ๊ทธ๋ฆฌ๊ณ  ์ˆซ์ž ํ˜•ํƒœ๋กœ ์ฟผํ„ฐ(', ")๊ฐ€ ํ•„ํ„ฐ๋ง๋˜์–ด ์žˆ์–ด ๋ฌธ์ž์—ด์„ ์ž…๋ ฅํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.
if($result['id']) echo "<h2>Hello {$result[id]}</h2>"; 
if($result['id'] == 'admin') solve("goblin");
  • ์œ„ ์ฟผ๋ฆฌ๋ฅผ ํ†ตํ•ด ์กฐํšŒ๊ฐ€ ์„ฑ๊ณตํ•  ๊ฒฝ์šฐ ์กฐํšŒ๋œ id์™€ ํ•จ๊ป˜ Hello ๋ฌธ๊ตฌ๋ฅผ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.
  • ๊ทธ๋ฆฌ๊ณ  id๊ฐ€ admin์ผ ๊ฒฝ์šฐ์— ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋จผ์ € no ๊ฐ’์— 1์ด๋ž‘ ๋‹ค๋ฅธ ์ˆซ์ž๋“ค์„ ๋„ฃ์—ˆ๋Š”๋ฐ 1์ด ๊ฒŒ์ŠคํŠธ ๊ณ„์ •์ž„์„ ์•Œ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
  • ํ˜น์‹œ๋‚˜ admin์— ํ•ด๋‹นํ•˜๋Š” ์ˆซ์ž๋ฅผ ์ฐพ์„ ์ˆ˜ ์žˆ์„๊นŒํ•˜๊ณ  ์—ฌ๋Ÿฌ ์ˆซ์ž๋“ค์„ ์‹œ๋„ํ•ด ๋ณด์•˜์ง€๋งŒ ์•„๋ฌด๊ฒƒ๋„ ์•ˆ ๋–ด์Šต๋‹ˆ๋‹ค.

  • ์šฐ์„  ๋จผ์ € id๋ฅผ admin์œผ๋กœ ๋ฐ”๊ฟ”์•ผ ํ•œ๋‹ค๋Š” ์ƒ๊ฐ์— no๋ฅผ false๊ฐ€ ๋˜๋„๋ก ํ•œ ๋’ค id๋ฅผ admin์œผ๋กœ ํ•˜๋Š” ๊ตฌ๋ฌธ์„ ์ž…๋ ฅํ–ˆ์Šต๋‹ˆ๋‹ค.
  • no=2 or id='admin'
  • ๊ทธ๋žฌ๋”๋‹ˆ No Quotes๋ผ๋Š” ๋ฌธ๊ตฌ๋ฅผ ๋–ด๋Š”๋ฐ ํŠน์ˆ˜๋ฌธ์ž๊ฐ€ ๋ง‰ํ˜€์žˆ๋‹ค๋Š” ๊ฒƒ์„ ๋‹ค์‹œ ๊นจ๋‹ฌ์•˜์Šต๋‹ˆ๋‹ค..

  • ๊ทธ๋ž˜์„œ ์ด๋ฒˆ์—๋Š” id='admin' ๊ฐ’์„ ์•„์Šคํ‚ค์ฝ”๋“œ๋กœ ๋ณ€ํ™˜ํ•ด์„œ ์ˆซ์žํ˜•์‹์œผ๋กœ ์ž…๋ ฅํ–ˆ์Šต๋‹ˆ๋‹ค.
  • no=2 or id=char(97, 100, 109, 105, 110)
  • ๊ทธ๋žฌ๋”๋‹ˆ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค!

์ฐธ๊ณ 

์•„์Šคํ‚ค ์ฝ”๋“œ ๋ณ€ํ™˜ ์‚ฌ์ดํŠธ

  • ์œ„ ์‚ฌ์ดํŠธ๋ฅผ ํ†ตํ•ด ๋ฌธ์ž์—ด์„ ์‰ฝ๊ฒŒ ์•„์Šคํ‚ค์ฝ”๋“œ๋กœ ๋ณ€ํ™˜ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

'๋ณด์•ˆ > CTF' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[์›นํ•ดํ‚น] | [LOS] Gremlin write up  (0) 2024.12.01
[์›นํ•ดํ‚น] | [LOS] Cobolt write up  (0) 2024.12.01
[Tryhackme] OhSINT  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Meta  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Browser Forensics - Cryptominer  (0) 2024.11.24
728x90

[๋ฌธ์ œ]

https://los.rubiya.kr/chall/cobolt_b876ab5595253427d3bc34f1cd8f30db.php

 

https://los.rubiya.kr/chall/cobolt_b876ab5595253427d3bc34f1cd8f30db.php

 

los.rubiya.kr


[๋ฌธ์ œ ํ’€์ด]

  $query = "select id from prob_cobolt where id='{$_GET[id]}' and pw=md5('{$_GET[pw]}')";
  • ์šฐ์„  ์ด ์ฟผ๋ฆฌ๋ฌธ์„ ํ†ตํ•ด pw๋ฅผ ์ „๋‹ฌ๋ฐ›์œผ๋ฉด md5๋กœ ์•”ํ˜ธํ™”ํ•œ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
  if($result['id'] == 'admin') solve("cobolt");
  • ๊ทธ๋ž˜์„œ, ์œ„ ์ฟผ๋ฆฌ๋ฌธ์„ ํ†ตํ•ด id๋ฅผ ๋ฐ›์•„์˜ค๋ฉด ๊ทธ id๊ฐ€ 'admin'์ด๋ฉด ๋ฌธ์ œ๋ฅผ ํ’€ ์ˆ˜ ์žˆ์„ ๊ฑฐ๋ผ๋Š” ์‚ฌ์‹ค์„ ์•Œ์•˜์Šต๋‹ˆ๋‹ค.

  • ์œ„์—์„œ ์ฟผ๋ฆฌ๋ฌธ ๋ถ„์„์„ ๋ฐ”ํƒ•์œผ๋กœ id๋ฅผ admin์œผ๋กœ ๋„˜๊ฒจ์ฃผ๊ณ  ๋’ค์—๋ฅผ ์ฃผ์„์ฒ˜๋ฆฌ๋ฅผ ํ•ด์„œ pw ์กฐ๊ฑด์„ ๋ฌดํšจํ™”ํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์‹œ๋„ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๋”ฐ๋ผ์„œ, URL์˜ php๋’ค์— ?id=admin'%23์„ ์ž…๋ ฅํ•ด์„œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์—ฌ๊ธฐ์„œ %23์€ php ์ฃผ์„์œผ๋กœ ์ฟผ๋ฆฌ๋ฌธ์˜ ๋’ท ๋‚ด์šฉ์„ ์ฃผ์„์ฒ˜๋ฆฌ ํ•ด์ค๋‹ˆ๋‹ค.

'๋ณด์•ˆ > CTF' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[์›นํ•ดํ‚น] | [LOS] Gremlin write up  (0) 2024.12.01
[์›นํ•ดํ‚น] | [LOS] Goblin write up  (0) 2024.12.01
[Tryhackme] OhSINT  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Meta  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Browser Forensics - Cryptominer  (0) 2024.11.24
728x90

[๋ฌธ์ œ]

https://tryhackme.com/r/room/ohsint

 

OhSINT

Are you able to use open source intelligence to solve this challenge?

tryhackme.com

  • OSINT๋Š” ๊ณต๊ฐœ๋œ ๋ฌด๋ฃŒ ์†Œ์Šค์—์„œ๋งŒ ์ˆ˜์ง‘๋˜๋Š” ์œ„ํ˜‘ ์ธํ…”๋ฆฌ์ „์Šค์˜ ํ•˜๋‚˜์˜ ์œ ํ˜•์ด๋‹ค.
  • ์ด ๋ฌธ์ œ๋Š” OSINT ๊ธฐ์ˆ ์„ ํ™œ์šฉํ•˜์—ฌ ์ œ๊ณต๋œ ์ด๋ฏธ์ง€๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๋‹ต์„ ์ฐพ์•„์•ผ ํ•œ๋‹ค.

[๋ฌธ์ œ ํ’€์ด]

What is this user's avatar of?

  • ๋จผ์ € ํ•ด๋‹น ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œ ํ›„ Exiftool์„ ์‚ฌ์šฉํ•ด์„œ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ๋ถ„์„ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • Copyright ํ•„๋“œ์—์„œ OWoodflint๋ผ๋Š” ์ •๋ณด๋ฅผ ์–ป์—ˆ์Šต๋‹ˆ๋‹ค.
  • ๋” ์ •๋ณด๋ฅผ ์–ป๊ธฐ ์œ„ํ•ด ๊ตฌ๊ธ€์— ๊ฒ€์ƒ‰์„ ํ–ˆ๋”๋‹ˆ ํ•ด๋‹น ์ด๋ฆ„์œผ๋กœ ํŠธ์œ„ํ„ฐ ๊ณ„์ •์ด ๋–ด๊ณ  ์•„๋ฐ”ํƒ€๋Š” ๊ณ ์–‘์ธ ๊ฒƒ์„ ๋ฐœ๊ฒฌํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: cat


What city is this person in?

 

  • ํ•ด๋‹น ๊ณ„์ •์— ๋“ค์–ด๊ฐ€๋‹ˆ ์‚ฌ์šฉ์ž๊ฐ€ ์ž‘์„ฑํ•œ ํŠธ์œ— ์ค‘ BSSID๋ฅผ ๋ฐœ๊ฒฌํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์ด BSSID๋ฅผ BSSID + Wigle.net ํžŒํŠธ๋ฅผ ์ด์šฉํ•ด์„œ wigle.net์—์„œ ๊ฒ€์ƒ‰์„ ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • wigle.net์—์„œ ๊ฒ€์ƒ‰์„ ํ†ตํ•ด ์‚ฌ์šฉ์ž๋Š” London์— ์žˆ๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์•„๋ƒˆ์Šต๋‹ˆ๋‹ค.
  • ํ•ด๋‹น ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๊ณ„์ •์ด ์žˆ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค! advanced search๋ฅผ ํ†ตํ•ด ๋ถ„์„ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: London


What is the SSID of the WAP he connected to?

  • wigle.net์—์„œ BSSID์™€ ์—ฐ๊ด€๋œ SSID๋„ ์ฐพ์„ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: UnileverWiFi


What is his personal email address?

What site did you find his email address on?

 
  • ์•„๊นŒ ๊ตฌ๊ธ€์— ๊ฒ€์ƒ‰ํ–ˆ์„ ๋•Œ ํŠธ์œ„ํ„ฐ ๊ณ„์ • ๋ฐ‘์— ๊นƒํ—ˆ๋ธŒ ํŽ˜์ด์ง€๋„ ๊ฐ™์ด ์žˆ์—ˆ๋Š” ๋ฐ ์ด๋ฒˆ์—๋Š” ์ •๋ณด๋ฅผ ๋” ์–ป๊ธฐ ์œ„ํ•ด ๊นƒํ—ˆ๋ธŒ ํŽ˜์ด์ง€์— ๋“ค์–ด๊ฐ”์Šต๋‹ˆ๋‹ค.
  • ํ•ด๋‹น ํŽ˜์ด์ง€์— ์‚ฌ์šฉ์ž์˜ ์ด๋ฉ”์ผ ์ฃผ์†Œ๋ฅผ ๋ฐœ๊ฒฌํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ์‚ฌ์šฉ์ž ์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” Github ํŽ˜์ด์ง€์—์„œ ๋ฐœ๊ฒฌ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: OWoodflint@gmail.com

๋‹ต: Github


Where has he gone on holiday?

  • ์ด๋ฒˆ์—๋Š” Github ํŽ˜์ด์ง€ ์ด๋ฉ”์ผ ์ฃผ์†Œ ๋ฐ‘์— ์žˆ๋Š” wordpress ๋ธ”๋กœ๊ทธ์— ๋“ค์–ด๊ฐ€ ๋ดค์Šต๋‹ˆ๋‹ค.

  • ๋“ค์–ด๊ฐ€ ๋ณด๋‹ˆ ์ง€๊ธˆ์€ New York์— ์žˆ๋‹ค๋Š” ์‚ฌ์‹ค์„ ์•Œ์•„๋ƒˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: New York


What is the person's password?

 

 

  • ๋จผ์ € ํžŒํŠธ๋ฅผ ์ด์šฉํ•ด ์†Œ์Šค ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•˜๋ผ๊ณ  ํ•ด์„œ wordpress์˜ ํŽ˜์ด์ง€์˜ ์†Œ์Šค ์ฝ”๋“œ๋ฅผ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๋น„๋ฐ€๋ฒˆํ˜ธ์™€ ๊ด€๋ จ๋œ ๋‹จ์„œ๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด password, flag, hint ๊ฐ™์€ ํ‚ค์›Œ๋“œ๋ฅผ ๊ฒ€์ƒ‰ํ–ˆ์ง€๋งŒ ์ •๋ณด๋ฅผ ์–ป์„ ์ˆ˜ ์—†์—ˆ์Šต๋‹ˆ๋‹ค.
  • ๊ทธ๋ž˜์„œ ์ด ๋ถ€๋ถ„์€ ๋‹ค๋ฅธ ๋ธ”๋กœ๊ทธ๋ฅผ ์ฐธ๊ณ ํ•˜๋‹ˆ ์ฃผ์„ ๋ถ€๋ถ„์— password๊ฐ€ ์ˆจ๊ฒจ์ ธ ์žˆ์—ˆ๋˜ ์ข€ ๊นŒ๋‹ค๋กœ์› ๋˜ ๋ฌธ์ œ์˜€์Šต๋‹ˆ๋‹ค..

๋‹ต: pennYDr0pper.!

 

OhSINTโ€Š—โ€ŠTryHackMe WriteUp

Open Source Intelligence (OSINT) is a sub-type of threat intelligence that is only gathered from free, public sources.

medium.com

 

728x90

[๋ฌธ์ œ]

https://blueteamlabs.online/home/challenge/meta-b976cec9e2

 

BTLO

 

blueteamlabs.online


[๋ฌธ์ œ ํ’€์ด]

Q1. What it the camera model?

https://hackingstudypad.tistory.com/263

 

[CTFlearn] Exif - ํฌ๋ Œ์‹ / ExifTool

CTFlearn์˜ ์Šค๋ฌผ๋‘๋ฒˆ์งธ ๋ฌธ์ œ ์ด๋ฒˆ๋ฌธ์ œ๋Š” ์–ผ๋งˆ์ „์— CTFlearn ์—์„œ ํ’€์–ด๋ณธ ๋ฌธ์ œ์™€ ๋˜‘๊ฐ™์ด ํ’€ ์ˆ˜ ์žˆ๋‹ค. (https://hackingstudypad.tistory.com/232) ๋งค๋ฒˆ ๋‹ค๋ฅธ ์œ ํ˜•์˜ ๋ฌธ์ œ๋งŒ ์ œ๊ณต๋˜๋Š”์ค„ ์•Œ์•˜๋Š”๋ฐ ๊ผญ ๊ทธ๋ ‡์ง„ ์•Š์€๊ฐ€

hackingstudypad.tistory.com

  • ์ด๋ฒˆ ๋ฌธ์ œ๋Š” ExifTool์„ ์‚ฌ์šฉํ•ด์„œ ๊ฐ ํŒŒ์ผ ์ด๋ฏธ์ง€๋ฅผ ๋ถ„์„ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
  • ExitTool ์‚ฌ์šฉ๋ฒ•์€ ์œ„ ๋งํฌ๋ฅผ ์ฐธ๊ณ ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • ํด๋” ์•ˆ์— exitftool ๋„๊ตฌ์™€ ๋ฌธ์ œ ํŒŒ์ผ์„ ๊ฐ™์ด ๋„ฃ์–ด๋†“๊ณ  ํด๋”์ด๋ฆ„ ์žˆ๋Š” ๊ณณ์— cmd๋ฅผ ์ž…๋ ฅํ•ด์„œ cmd์ฐฝ์„ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ๊ทธ๋‹ค์Œ, exiftool ํŒŒ์ผ๋ช…์„ ์ž…๋ ฅํ•˜๋ฉด ์ด๋ฏธ์ง€์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๋ฅผ ์ถ”์ถœํ•ด ์ฃผ๋Š”๋ฐ ๊ทธ ๋ฐ์ดํ„ฐ ์†์— camera model ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: Canon EOS 550D


Q2. When was the picture taken?

  • ์งˆ๋ฌธ์— ๋‹ต์„ ์ฐพ๊ธฐ ์œ„ํ•ด ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ์—์„œ Date/Time Original๊ณผ Create Date ์ •๋ณด๋ฅผ ์ฐพ์•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ ๋‹ต์„ ์–ป์„ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: 2021:11:02 13:20:23


Q3. What does the comment on the fitst image says?

  • ์ด๋ฒˆ์—๋„ ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€์˜ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ์—์„œ ์ •๋ณด๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด Comment ์„น์…˜์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.
  • Comment ์„น์…˜์—์„œ ๋‹ต์„ ๋ฐ”๋กœ ๋ฐœ๊ฒฌํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: relying on altered metadata to catch me?


Q4. Where could the ciminal be?

  • ์ด ๋ฌธ์ œ๋Š” ๋ฆฌ๋ฒ„์Šค ์ด๋ฏธ์ง€ ๊ฒ€์ƒ‰์„ ํ†ตํ•ด ๋ฒ”์ธ์˜ ์œ„์น˜๋ฅผ ์ฐพ์•„๋‚ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  • ๊ทธ๋ž˜์„œ ๊ตฌ๊ธ€ ์ด๋ฏธ์ง€ ๊ฒ€์ƒ‰ ์—”์ง„์„ ํ†ตํ•ด ์ด๋ฏธ์ง€๋“ค์„ ๋„ฃ์–ด์„œ ์ •๋ณด๋ฅผ ์•Œ์•„๋‚ด๋ ค๊ณ  ํ–ˆ๋Š”๋ฐ ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€๋Š” ๋ถ€์ •ํ™•ํ•˜๊ฒŒ ๋‚˜์™€์„œ ๋‘ ๋ฒˆ์งธ ์ด๋ฏธ์ง€๋ฅผ ๋„ฃ์—ˆ๋”๋‹ˆ ๋„์‹œ๊ฐ€ ์นดํŠธ๋งŒ๋‘์ž„์„ ์•Œ์•„๋ƒˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: Kathmandu

'๋ณด์•ˆ > CTF' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[์›นํ•ดํ‚น] | [LOS] Cobolt write up  (0) 2024.12.01
[Tryhackme] OhSINT  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Browser Forensics - Cryptominer  (0) 2024.11.24
[ํฌ๋ Œ์‹] OlympicDestroyer - Volatility Contest 2018  (1) 2024.11.19
[ํฌ๋ Œ์‹] cridex  (0) 2024.11.18
728x90

[๋ฌธ์ œ]

SOC์—์„œ ๋„คํŠธ์›Œํฌ์— ์ƒˆ๋กœ ํ•ฉ๋ฅ˜ํ•œ PC์—์„œ ์•”ํ˜ธํ™”ํ ์ฑ„๊ตด๊ณผ ๊ด€๋ จ๋œ ํŠธ๋ž˜ํ”ฝ์ด ๋ฐœ์ƒํ–ˆ๋‹ค๋Š” ์•Œ๋ฆผ์„ ๋ฐ›์•˜์Šต๋‹ˆ๋‹ค.

์ด์— ๋Œ€์‘ํ•˜์—ฌ, Incident Response ํŒ€์ด ์ฆ‰์‹œ ์กฐ์น˜๋ฅผ ์ทจํ–ˆ์œผ๋ฉฐ, ํ•ด๋‹น ํŠธ๋ž˜ํ”ฝ์ด ๋ธŒ๋ผ์šฐ์ € ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋ฐœ์ƒํ•˜๊ณ  ์žˆ์Œ์„ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

ํŒ€์€ FTK Imager๋ฅผ ์‚ฌ์šฉํ•ด ๋ชจ๋“  ์ฃผ์š” ๋ธŒ๋ผ์šฐ์ € ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ–ˆ๊ณ , ์ด์ œ ๋‹น์‹ ์ด ad1 ํŒŒ์ผ์„ ์ด์šฉํ•ด ์•”ํ˜ธํ™”ํ ์ฑ„๊ตด ํ™œ๋™์„ ์กฐ์‚ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

https://blueteamlabs.online/home/challenge/browser-forensics-cryptominer-aa00f593cb

 

BTLO

 

blueteamlabs.online

 


[๋ฌธ์ œ ํ’€์ด]

Q1. How many browser-profiles are present in Google Chrome?

  • ๋จผ์ € FTK Imager ํˆด์„ ์ด์šฉํ•ด์„œ ํŒŒ์ผ์„ ์—ด์–ด ๋ถ„์„ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • ํ”„๋กœํ•„ ํด๋” ๊ฐœ์ˆ˜๋ฅผ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด Default ํด๋” ์™ธ์— Profile 1, Profile 2์™€ ๊ฐ™์€ ์ด๋ฆ„์˜ ํด๋”๋“ค์ด ๋ช‡ ๊ฐœ์ธ์ง€ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.
  • profile 1 ๊ฐ™์€ ์ด๋ฆ„์˜ ํด๋”๋“ค์€ ๊ฐ ํด๋”๊ฐ€ ํ•˜๋‚˜์˜ ํ”„๋กœํ•„์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
  • ์ด ํŒŒ์ผ์—์„œ๋Š” Default์™€ Profile 1 2๊ฐœ์˜ ํด๋”๊ฐ€ ์žˆ๋Š” ๊ฒƒ์„ ์•Œ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: 2


Q2. What is the name of the browser theme installe on Google Chrome?

  • ๋จผ์ € FTK Imager์—์„œ Preferences ํŒŒ์ผ์„ ์—ด์—ˆ์Šต๋‹ˆ๋‹ค.
  • "theme" ๋˜๋Š” "extension" ํ‚ค์›Œ๋“œ๋ฅผ ๊ฒ€์ƒ‰ํ–ˆ๋”๋‹ˆ ์„ค์น˜๋œ ํ…Œ๋งˆ์˜ ID ๋˜๋Š” ์ด๋ฆ„ ์ •๋ณด๊ฐ€ ํฌํ•จ๋œ JSON ๋ฐ์ดํ„ฐ๊ฐ€ ํ‘œ์‹œ๋์Šต๋‹ˆ๋‹ค.
  • ํ…Œ๋งˆ ID๋ฅผ Google์—์„œ ๊ฒ€์ƒ‰ํ–ˆ๋”๋‹ˆ ํ•ด๋‹น ํ…Œ๋งˆ ์ด๋ฆ„์„ ์ฐพ์„ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: Earth in Space


Q3. Identify the Extension ID and Extension Name of the cryptominer

  • extensions ํ•ญ๋ชฉ ์•„๋ž˜์—์„œ, ์„ค์น˜๋œ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ๋“ค์˜ ID๊ฐ€ ๋‚˜์—ด์ด ๋˜์–ด์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ๊ฐ์˜ manifest.json ํŒŒ์ผ์„ ์—ด์–ด ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์˜ name์„ ๋ถ„์„ํ–ˆ๋”๋‹ˆ cryptominer์˜ name์„ ์•Œ์•„๋‚ผ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: egnfmleidkolminhjlkaomjefheafbbb, DFP Cryptocurrency Miner


Q4. What is the description text of this extension?

 

  • 3๋ฒˆ ๋ฌธ์ œ์˜ ๊ฐ™์€ ํŒŒ์ผ์—์„œ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์˜ description๋„ ๋ฐœ๊ฒฌํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: Allows staff members to mine cryptocurrency in the background of their web browser


Q5. What is the name of the specific javascript web miner used in the browser extension?

  • ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์˜ javaScript ํŒŒ์ผ์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” background.js, content.js, main.js ํŒŒ์ผ์„ ๋ถ„์„ํ•˜๊ธฐ๋กœ ํ–ˆ์Šต๋‹ˆ๋‹ค.
  • background.js ํŒŒ์ผ์—์„œ name of the specific javascript web miner์„ ๋ฐœ๊ฒฌํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: cryptoloot


Q6. How many hashes is the crypto miner calculating per second?

  • background.js์—์„œ hashesPerSecond ํ•จ์ˆ˜๋ฅผ ํ†ตํ•ด ๋ช‡ ์ดˆ๋งˆ๋‹ค ๊ณ„์‚ฐ๋˜๋Š”์ง€ ์•Œ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: 20


Q7. What is the public key associated with this mining activity?

  • ์•”ํ˜ธํ™” ์ฑ„๊ตด ํ™œ๋™์€ ๋ณดํ†ต ํŠน์ • ์ฑ„๊ตด ์„œ๋น„์Šค์™€ ์—ฐ๊ฒฐ๋ฉ๋‹ˆ๋‹ค.
  • JavaScript ํŒŒ์ผ์—์„œ๋Š” var miner = new CryptoLoot.Anonymous('YOUR_PUBLIC_KEY_HERE'); ๊ฐ™์€ ํŒจํ„ด์œผ๋กœ ๋ฐœ๊ฒฌ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์—ฌ๊ธฐ์„œ 'YOUR_PUBLIC_KEY_HERE'๊ฐ€ ์ฑ„๊ตด ํ™œ๋™๊ณผ ์—ฐ๊ด€๋œ ๊ณต๊ฐœํ‚ค ์ž…๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ํ•ด๋‹น ๋ฌธ์ œ์˜ ๊ณต๊ฐœํ‚ค๋Š” b23efb4650150d5bc5b2de6f05267272cada06d985a0 ์ž…๋‹ˆ๋‹ค.

๋‹ต: b23efb4650150d5bc5b2de6f05267272cada06d985a0


Q8. What is the URL of the official Twitter page of the javascript web miner?

 

  • ์ด ๋ฌธ์ œ๋Š” Crypto-Loot์˜ ๊ณต์‹ ํŠธ์œ„ํ„ฐ ํŽ˜์ด์ง€ URL์„ ์ฐพ๋Š” ๋ฌธ์ œ๋กœ ํ•ด๋‹น ์ด๋ฆ„์œผ๋กœ ๊ณต์‹ ํŠธ์œ„ํ„ฐ๋ฅผ ๊ฒ€์ƒ‰ํ–ˆ์Šต๋‹ˆ๋‹ค.

๋‹ต: twitter.com/CryptoLootMiner

'๋ณด์•ˆ > CTF' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Tryhackme] OhSINT  (0) 2024.11.24
[ํฌ๋ Œ์‹] | [BTLO] Meta  (0) 2024.11.24
[ํฌ๋ Œ์‹] OlympicDestroyer - Volatility Contest 2018  (1) 2024.11.19
[ํฌ๋ Œ์‹] cridex  (0) 2024.11.18
[๋ฆฌ๋ฒ„์‹ฑ] | [๋“œ๋ฆผํ•ต] rev-basic-2  (0) 2024.11.17
728x90

1. ์™ธ๋ถ€ํ†ต์‹  ๊ด€๋ จ ์ฝ”๋“œ

  • ์™ธ๋ถ€์™€ ํ†ต์‹ ํ•  ๋•Œ, Win32 Internet API ๋ฐ Win32 Socket API๋ฅผ ์‚ฌ์šฉ
  • ๊ทธ ๊ณผ์ •์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›๋Š” ๋™์ž‘์„ ์ˆ˜ํ–‰
    • UDP ํ†ต์‹ : ๋‹จ๋ฐฉํ–ฅ ํ†ต์‹ 
    • TCP ํ†ต์‹ : ์–‘๋ฐฉํ–ฅ ํ†ต์‹ 

1.1 ๋™์ž‘ ํ™•์ธ

  • Sample 07.exe๋Š” Internet API๋ฅผ ์‚ฌ์šฉํ•ด์„œ procexp.exe๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์‹คํ–‰.
  • procexp.exe๋Š” MS์—์„œ ์ œ๊ณตํ•˜๋Š” ํ”„๋กœ์„ธ์Šค ๋ชจ๋‹ˆํ„ฐ๋ง Tool
  • TCPView.exe(sysinternals์—์„œ ์ œ๊ณตํ•˜๋Š” ๋„คํŠธ์›Œํฌ ๋ชจ๋‹ˆํ„ฐ๋ง Tool)๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด Sample 07.exe๊ฐ€ "live.sysinternals.com"์œผ๋กœ ์ ‘์†ํ•˜๋Š” ๊ฒƒ์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.
  • ๊ทธ ๊ฒฐ๊ณผ "%temp%" ๊ฒฝ๋กœ์— procexp.exe๊ฐ€ ๋‹ค์šด๋กœ๋“œ๋˜๊ณ  ๋‹ค์šด๋กœ๋“œ ์™„๋ฃŒ๋œ procexp.exe๋ฅผ ์‹คํ–‰ํ•˜๊ณ  ๋‚˜๋ฉด Sample 07.exe์˜ ๋™์ž‘์ด ๋๋‚œ๋‹ค.

1.2 ์ฝ”๋“œ ํ•™์Šต

  • procexp.exe๋ฅผ ๋‹ค์šด๋กœ๋“œ ํ•œ๋‹ค๊ณ  ํ–ˆ์„ ๋•Œ, ๋ฐ›์€ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ๊ณต๊ฐ„์ด ์žˆ์–ด์•ผ ํ•œ๋‹ค.
  • "%temp%" ๊ฒฝ๋กœ์— procexp.exe๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ํŒŒ์ผ์„ ๋ฏธ๋ฆฌ ์ƒ์„ฑํ•œ๋‹ค.

 

  • InternetOpen() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ WinINet ํ•จ์ˆ˜๋ฅผ ์ดˆ๊ธฐํ™”ํ•œ๋‹ค.(Internet API๋ฅผ ์œ„ํ•œ ์ค€๋น„ ์ž‘์—…)

  • InternetOpenUrl() API๋ฅผ ์“ฐ๋ฉด URL์— ์ง€์ •๋œ ๋ฆฌ์†Œ์Šค๋ฅผ ์—ด ์ˆ˜ ์žˆ๋‹ค.
  • ๋‘ ๋ฒˆ์งธ ์ธ์ž ๊ฐ’ 'IpUrlPath'์—๋Š” URL("http://live.sysinternals.com/procexp.exe")๊ฐ€ ๋“ค์–ด๊ฐ„๋‹ค.

  • InternetReadFile() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์„œ๋ฒ„์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ์–ด์˜ฌ ์ˆ˜ ์žˆ๋‹ค.
  • InternetReadFile()์˜ ์„ธ ๋ฒˆ์งธ ์ธ์ž์—๋Š” ํฌ๊ธฐ ๊ฐ’์ด ๋“ค์–ด๊ฐ€๋ฏ€๋กœ ๋จผ์ € ํฌ๊ธฐ๋ฅผ ๋ฌผ์–ด๋ด์•ผ ํ•œ๋‹ค.
  • ํฌ๊ธฐ๋ฅผ ๋ฌผ์–ด๋ณด๊ธฐ ์œ„ํ•ด์„œ๋Š” InternetQueryDataAvailable() API๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. ๊ทธ ๊ฒฐ๊ณผ ์„œ๋ฒ„์—์„œ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ๋ฐ์ดํ„ฐ์˜ ํฌ๊ธฐ๊ฐ€ 'dwSize'๋กœ ๋“ค์–ด๊ฐ€๊ฒŒ ๋œ๋‹ค.
  • ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›๊ณ  ๋‚˜๋ฉด "%temp%" ๊ฒฝ๋กœ์— ์žˆ๋Š” procexp.exe์— ์ฑ„์›Œ ๋„ฃ๊ณ  ์ด ์ž‘์—…์€ procexp.exe ๋‹ค์šด๋กœ๋“œ๊ฐ€ ์™„๋ฃŒ๋  ๋•Œ๊นŒ์ง€ ๋ฐ˜๋ณต๋œ๋‹ค.
  • ๋‹ค์šด๋กœ๋“œ ์—ฌ๋ถ€๋Š” 'dwRead'๊ฐ’์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ณ  'dwRead'์—๋Š” ์ฝ์€ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์„ ๋ณ€์ˆ˜์˜ ํฌ์ธํ„ฐ๊ฐ€ ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค.
  • ๋งŒ์•ฝ ๋‹ค์šด๋กœ๋“œ๊ฐ€ ๋๋‚˜๊ฑฐ๋‚˜ Error ๊ฐ€ ๋ฐœ์ƒํ•  ๊ฒฝ์šฐ 0์ด ๋“ค์–ด๊ฐ€๊ณ , ์ด๋•Œ ๋‹ค์šด๋กœ๋“œ ๋™์ž‘์ด ์ข…๋ฃŒ๋œ๋‹ค.

  • ๋‹ค์šด๋กœ๋“œ๊ฐ€ ๋๋‚˜๋ฉด ํ•ธ๋“ค์€ ๋ฐ˜ํ™˜์ด ๋˜๊ณ  ๋งˆ์ง€๋ง‰์œผ๋กœ procexp.exe๋ฅผ ์‹คํ–‰ํ•˜๊ณ  Sample 07.exe๋Š” ์ข…๋ฃŒ๋œ๋‹ค.


1.3 ํŒŒ์ผ ๋ถ„์„

  • Sample 07.exe๋Š” "%temp%" ๊ฒฝ๋กœ๋ฅผ ์•Œ์•„๋‚ธ ๋’ค์— procexp.exe ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค.

  • ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์‹ ๋ฐ›๊ธฐ ์œ„ํ•ด์„œ๋Š” InternetOpenUrlA() ํ˜ธ์ถœํ•ด์„œ "https://live.sysinternals.com/procexp.exe"๋กœ ์—ฐ๊ฒฐ์„ ์‹œ๋„ํ•œ๋‹ค.
  • ์—ฐ๊ฒฐ ์ˆ˜๋ฆฝ ์—ฌ๋ถ€๋Š” InternetOpenUrlA() ๋ฆฌํ„ด ๊ฐ’์œผ๋กœ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
  • InternetQueryDataAvailable() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํ•œ ๋ฒˆ์— ์–ผ๋งˆ๋งŒํผ์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ ์ˆ˜ ์žˆ๋‹ค.

  • ๊ทธ๋ฆฌ๊ณ  ๊ทธ๋งŒํผ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์•„์„œ ํŒŒ์ผ์— ๋‹ด์œผ๋ฉด ๋œ๋‹ค. InternetReadFile() API๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด 'IpBuffer'๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ์ฃผ์†Œ์— ํŒŒ์ผ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด์˜จ๋‹ค.
  • 'DWORD PTR SS:[ESP+10]'์€ 'dwRead'๊ฐ’์„ ๊ฐ€๋ฆฌํ‚จ๋‹ค. ์ด ๊ฐ’์ด 0์ด ์•„๋‹ˆ๋ฉด ๋ฐ์ดํ„ฐ ์ˆ˜์‹  ๋™์ž‘์ด ๊ณ„์† ๋ฐ˜๋ณต๋˜๊ณ  'dwRead'๊ฐ’์ด 0์ด ๋  ๋•Œ, ๋‹ค์šด๋กœ๋“œ ๋™์ž‘์ด ๋๋‚˜๊ณ  ํ•ธ๋“ค ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

  • ๋‹ค์šด๋กœ๋“œํ•œ procexp.exe๋ฅผ ์‹คํ–‰์‹œํ‚ค๋ฉด Sample 07.exe ๋™์ž‘์€ ๋งˆ๋ฌด๋ฆฌ๋œ๋‹ค.

2. Window ์ œ์–ด ์ฝ”๋“œ ํ•™์Šต ๋ฐ ๋ถ„์„

  • Windows ์šด์˜์ฒด์ œ๋Š” ๋‹ค์ค‘ ์‹คํ–‰ ํ™˜๊ฒฝ์„ ์ œ๊ณตํ•˜๋Š” ๋ฐ ์ด๋Ÿฌํ•œ ํ™˜๊ฒฝ ์†์— ์œˆ๋„์šฐ๋“ค ๊ฐ„์— ๋™๊ธฐํ™”๋‚˜ ๋ฐ์ดํ„ฐ ๊ตํ™˜์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์„œ๋กœ๋ฅผ ์•Œ์•„๋‚ด๋Š” ๋ฐฉ๋ฒ•์ด ํ•„์š”ํ•˜๋‹ค.

2.1 ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žจ์˜ ์œˆ๋„์šฐ ์ œ์–ด

  • FindWindow() API๋Š” ํด๋ž˜์Šค ์ด๋ฆ„๊ณผ Caption ์ด๋ฆ„์„ ์‚ฌ์šฉํ•ด์„œ ์›ํ•˜๋Š” ์œˆ๋„์šฐ์˜ ํ•ธ๋“ค ๊ฐ’์„ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค.
  • ์œˆ๋„์šฐ๋ฅผ ์ฐพ์ง€ ๋ชปํ–ˆ์„ ๋•Œ, NULL ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

  • ์ฒซ ๋ฒˆ์งธ ์ธ์ž์ธ lpClassName์€ ํด๋ž˜์Šค๋ช…, ๋‘ ๋ฒˆ์งธ ์ธ์ž์ธ lpszWindowName์€ ์œˆ๋„์šฐ ์บก์…˜๋ช…์„ ์˜๋ฏธํ•œ๋‹ค.
  • ๋‘˜ ๋‹ค ์˜ต์…˜์ด๊ธฐ ๋•Œ๋ฌธ์— ํ•„์š”์— ๋”ฐ๋ผ ๋„ฃ๊ฑฐ๋‚˜ NULL ๊ฐ’์„ ์ค„ ์ˆ˜ ์žˆ๋‹ค.(๊ฒ€์ƒ‰์˜ ์ •ํ™•๋„๋ฅผ ๋†’์ด๊ธฐ ์œ„ํ•ด์„œ ๊ฐ’์„ ๋ชจ๋‘ ๋„ฃ์–ด์ค˜๋„ ๋œ๋‹ค.)

  • FindWindow()๋Š” ์ตœ์ƒ์œ„ ์œˆ๋„์šฐ๋ฅผ ์ฐพ์„ ๋•Œ ์‚ฌ์šฉํ•˜๋Š” API๋กœ ์–ด๋–ค ์œˆ๋„์šฐ์— ์ข…์†๋œ ์œˆ๋„์šฐ๋ฅผ ์ฐพ๊ณ ์ž ํ•  ๋•Œ๋Š” FindWindowEx()๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.
  • FindWindowEX() API๋Š” FindWindow()์˜ ๊ธฐ๋Šฅ์„ ๋ชจ๋‘ ํฌํ•จํ•˜๊ณ  ์ถ”๊ฐ€์ ์ธ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค.
  • ์ฒซ ๋ฒˆ์งธ ์ธ์ž์ธ hwndParent๋Š” ์ž์‹ ์ด ์ฐพ๋Š” ์œˆ๋„์šฐ์˜ ์ตœ์ƒ์œ„ ์œˆ๋„์šฐ ํ•ธ๋“ค์ด๋‹ค. ์—ฌ๊ธฐ์— NULL ๊ฐ’์„ ์ฃผ๋ฉด FindWindow()์™€ ๋™์ผํ•˜๊ฒŒ ๋™์ž‘.
  • ๋‘ ๋ฒˆ์งธ ์ธ์ž์ธ hwndChildAfter๋Š” ๋™์ผํ•œ level์˜ ์œˆ๋„์šฐ๋“ค ์ค‘์—์„œ ๊ฒ€์ƒ‰ ์‹œ์ ์„ ๊ฒฐ์ •ํ•˜๋Š” ์š”์†Œ์ด๋‹ค. ๋ณดํ†ต NULL ๊ฐ’์„ ์‚ฌ์šฉํ•œ๋‹ค.

*P13~20

FindWindow()๋ฅผ ์‚ฌ์šฉํ•ด์„œ notepad.exe์— ๋ฌธ์ž์—ด ์ถœ๋ ฅ์‹œํ‚ค๋Š” ์—ฐ์Šต์€ ๋‹ค์Œ์— ์ด์–ด์„œ....

 


2.2 ๋™์ž‘ ํ™•์ธ

:Sample 08.exe๋Š” InternetExplorer.exe๋ฅผ ์‹คํ–‰ํ•˜๊ณ  ํŠน์ • ์›น ํŽ˜์ด์ง€์— ์ ‘์†ํ•˜๋„๋ก ๋งŒ๋“ ๋‹ค.

  1. InternetExploer๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.
  2. ์ฃผ์†Œ ์ž…๋ ฅ์ฐฝ์„ ์ฐพ๊ณ  ํ•ธ๋“ค์„ ํš๋“ํ•œ๋‹ค.
  3. ์ฃผ์†Œ ์ž…๋ ฅ์ฐฝ์— "www.naver.com" ๋ฌธ์ž์—ด์„ ์ž…๋ ฅํ•˜๊ณ  ENTER ๋ฉ”์‹œ์ง€๋ฅผ ์ „์†กํ•œ๋‹ค.

2.3 ์ฝ”๋“œ ํ•™์Šต

  •  FindWindow() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ๋Š” "์–ด๋–ค ์œˆ๋„์šฐ์— ๋ฌด์Šจ ๋ฉ”์‹œ์ง€๋ฅผ ๋˜์งˆ ๊ฒƒ์ธ๊ฐ€?"๊ฐ€ ๊ฐ€์žฅ ์ค‘์š”.
    • ๋‚ด๊ฐ€ ์ฐพ์€ ์œˆ๋„์šฐ๊ฐ€ ๋ฉ”์‹œ์ง€ ์ „๋‹ฌ ๋Œ€์ƒ์ด ์•„๋‹Œ ๊ฒฝ์šฐ
    • ์ž˜๋ชป๋œ ๋ฉ”์‹œ์ง€๋ฅผ ์ „๋‹ฌํ•ด์„œ ์ œ๋Œ€๋กœ ๋™์ž‘ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ
    • ๋งŽ์€ ํ™•์ธ ๊ณผ์ • ํ•„์š”
  • Spy++์˜ Find๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•ด์„œ ์ฃผ์†Œ๊ฐ€ ์ž…๋ ฅ๋˜๋Š” ์œˆ๋„์šฐ๋ฅผ ํ™•์ธ
  • ํƒ€๊นƒ์œผ๋กœ ์‚ผ์€ ์œˆ๋„์šฐ InternetExplorer.exe์˜ ์ฃผ์†Œ ์ž…๋ ฅ์ฐฝ์— URL ์ž…๋ ฅํ•˜๊ณ  Enter ํ‚ค๋ฅผ ์ „๋‹ฌํ•˜๋ฉด ์›ํ•˜๋Š” ์ฃผ์†Œ๋กœ ์ ‘์†

  • ์‹ค์ œ ํƒ€๊นƒ ์œˆ๋„์šฐ์™€ ์ผ์น˜ํ•˜์ง€ ์•Š์Œ

  • InternetExplorer.exe๋Š” Windows์—์„œ ๊ธฐ๋ณธ์œผ๋กœ ์„ค์น˜๋˜๋Š” ์†Œํ”„ํŠธ์›จ์–ด์ด๊ธฐ ๋•Œ๋ฌธ์— ์„ค์น˜ ๊ฒฝ๋กœ๊ฐ€ ์ •ํ•ด์ ธ ์žˆ๋‹ค. ์ด ์ ์„ ์ด์šฉํ•ด์„œ InternetExplorer.exe ๊ฒฝ๋กœ๋ฅผ ๋งŒ๋“ค๊ณ  ์‹คํ–‰ํ•œ๋‹ค.

  • FindWindow()์™€ FindWindowEx() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ InternetExplorer.exe์˜ Edit ์œˆ๋„์šฐ ํ•ธ๋“ค์„ ์–ป์œผ๋ฉด ๋œ๋‹ค.

  • Edit ์œˆ๋„์šฐ์— URL์„ ์ž…๋ ฅํ•˜๊ณ  Enter ์ด๋ฒคํŠธ๊ฐ€ ๋ฐœ์ƒํ•˜๋„๋ก ๊ฐ€์ƒํ‚ค ์ฝ”๋“œ๋ฅผ ์ „๋‹ฌํ•˜๋ฉด ๋œ๋‹ค.


2.4 ํŒŒ์ผ ๋ถ„์„

  • Sample 08.exe ํŒŒ์ผ์„ ๋ถ„์„ํ•˜๊ธฐ ์œ„ํ•ด ExpandEnvironmentStrings() API๋ฅผ ์‚ฌ์šฉ
    • ExpandEnvironmentString() API๋Š” ํŠน์ • ํ™˜๊ฒฝ ๋ณ€์ˆ˜์— ๋Œ€ํ•œ ๊ฒฝ๋กœ ๊ฐ’์„ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค.
    • ์ด๋ฅผ ์ด์šฉํ•ด "%ProgramFiles%" ๊ฒฝ๋กœ๋ฅผ ์•Œ์•„๋‚ผ ์ˆ˜ ์žˆ๋‹ค.

  • "\Internet Explorer\iexplore.exe" ๋ฌธ์ž์—ด์„ ๋”ํ•˜๊ณ  WinExec() API๋ฅผ ํ˜ธ์ถœํ•ด์„œ Internet Explorer.exe๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.

  • ๋ฌธ์ž์—ด์„ ํ•ฉ์น˜๋Š” ๊ณผ์ •์—์„œ ์–ด์…ˆ๋ธ”๋ฆฌ ์ฝ”๋“œ๋“ค์˜ ์—ญํ• 

  • InternetExplore.exe๊ฐ€ ์™„์ „ํžˆ ์‹คํ–‰๋  ๋•Œ๊นŒ์ง€ ์ผ์ •์‹œ๊ฐ„์„ ๋Œ€๊ธฐํ•œ ๋‹ค์Œ, FindWindow()์™€ FindWindowEx() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ ํƒ€๊นƒ ์œˆ๋„์šฐ๋ฅผ ์ฐพ๋Š”๋‹ค.
  • IEFrame๋ถ€ํ„ฐ ์ฐจ๋ก€๋กœ ์ž์‹ ์œˆ๋„์šฐ๋ฅผ ์ฐพ์•„๊ฐ€๋‹ค ๋ณด๋ฉด Edit ์œˆ๋„์šฐ์˜ ํ•ธ๋“ค ๊ฐ’์„ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค.
  • Edit ์œˆ๋„์šฐ์— URL ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•˜๋„๋ก ์„ค์ •ํ•œ๋‹ค. SendMessage()๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์œˆ๋„์šฐ์— ๋ฉ”์‹œ์ง€๋ฅผ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋‹ค.

  • WM_KEYDOWN ๋ฉ”์‹œ์ง€๋ฅผ ์ „๋‹ฌํ•ด์„œ ์—”ํ„ฐํ‚ค๋ฅผ ๋ˆ„๋ฅด๋Š” ๊ฒƒ๊ณผ ๊ฐ™์€ ํšจ๊ณผ๊ฐ€ ๋ฐœ์ƒํ•˜๋„๋ก ํ•œ๋‹ค.
  • ๊ทธ ๊ฒฐ๊ณผ ํŠน์ • ์›น ํŽ˜์ด์ง€๋กœ ์ ‘์†ํ•˜๊ฒŒ ๋œ๋‹ค. ์„ธ ๋ฒˆ์งธ ์ธ์ž๋กœ ๋“ค์–ด๊ฐ€๋Š” 0x0D๋Š” ๊ฐ€์ƒํ‚ค ๊ฐ’์œผ๋กœ VK_RETURN์„ ์˜๋ฏธํ•œ๋‹ค.

3. TEB & PEB

  • Windows์—์„œ API๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๋ฐฉ์‹์€ ์ง์ ‘ ํ˜ธ์ถœ๊ณผ ๊ฐ„์ ‘ ํ˜ธ์ถœ๋กœ ๋‚˜๋ˆŒ ์ˆ˜ ์žˆ๋‹ค.
  • ํ˜ธ์ถœ ์ฃผ์†Œ ์ •๋ณด๋ฅผ IAT์— ๊ธฐ๋กํ•ด๋†“๊ณ  ์ฐธ์กฐํ•˜๋Š”์ง€, ์•„๋‹ˆ๋ฉด ์ง์ ‘ ์•Œ์•„๋‚ด๋Š”์ง€์˜ ์ฐจ์ด๊ฐ€ ์žˆ๋‹ค๊ณ  ๋ณด๋ฉด ๋œ๋‹ค.(์ง€๊ธˆ๊นŒ์ง€๋Š” ๋ชจ๋‘ API ๊ฐ„์ ‘ ํ˜ธ์ถœ ์‚ฌ์šฉ)

  • ์—ฌ๊ธฐ์„œ 'CALL DWORD PTR DS:[0x00405000]'์€ 0x00405000 ์ฃผ์†Œ์— ์žˆ๋Š” 4๋ฐ”์ดํŠธ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค๋Š” ์˜๋ฏธ
  • 0x00405000 ์ฃผ์†Œ๋Š” Import Address Table์ด๊ณ  WinExec() API ์ฃผ์†Œ๊ฐ€ ๊ธฐ๋ก๋˜์–ด ์žˆ๋‹ค. ๊ทธ ๊ฒฐ๊ณผ WinExec() API๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

 

  • ์ง์ ‘ ํ˜ธ์ถœ์€ WinExec()๋Š” Kernel32.dll์—์„œ Export ํ•˜๋Š” API๋‹ค.
  • ํ˜ธ์ถœ ์ฃผ์†Œ๋Š” ๋‹น์—ฐํžˆ Kernel32.dll์˜ Export Table์— ๊ธฐ๋ก๋˜์–ด ์žˆ๋‹ค. Export Table์˜ ์œ„์น˜ ์ •๋ณด๋Š” PE Header์— ์žˆ๋‹ค.
  1. Kernel32.dll์— ๋กœ๋“œ๋˜์–ด ์žˆ๋Š” ์ฃผ์†Œ๋ฅผ ์•Œ์•„๋‚ธ๋‹ค.(= ImageBase)
  2. ImageBase๋ฅผ ๊ธฐ์ค€์œผ๋กœ +0x0000008D ์ฃผ์†Œ์—๋Š” EXPORT Table์˜ RVA๊ฐ€ ๊ธฐ๋ก๋˜์–ด ์žˆ๋‹ค.
  3. EXPORT Table๋กœ ์ด๋™ํ•ด์„œ WinExec() API์˜ ํ˜ธ์ถœ ์ฃผ์†Œ๋ฅผ ์–ป๋Š”๋‹ค.
  4. WinExec() API๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

** ๋‹ค์Œ์— ๋” ์ด์–ด์„œ....

 

728x90

1. ์‹œ์Šคํ…œ ์„ค์ • ๋ณ€๊ฒฝ ์•…์„ฑํŒŒ์ผ ๋ถ„์„

1.1 ์†Œ๊ฐœ

  • challenge 02.exe๋Š” ๊ฐ์—ผ PC์˜ ์‹œ์Šคํ…œ ์„ค์ •์„ ๋ณ€๊ฒฝํ•˜๊ณ  ํ‚ค ์„ค์ •์„ ์กฐ์ž‘ํ•˜๋Š” ๋“ฑ์˜ ์•…์„ฑํ–‰์œ„๋ฅผ ํ•œ๋‹ค.
  • ๊ทธ ๊ณผ์ •์—์„œ ํŒŒ์ผ ๋ฐ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๊ด€๋ จ ์ฝ”๋“œ๋ฅผ ๋งŽ์ด ์‚ฌ์šฉํ•œ๋‹ค.


1.2 Challenge 02.exe ๋ถ„์„

1.2.1 ๊ธฐ๋ณธ ๋™์ž‘

  • Stub ์ฝ”๋“œ๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ฐ€์ง€๋Š” GetStartupInfo(), GetCommandLine() ๋“ฑ์˜ ์ฝ”๋“œ๋Š” 0x0041D313 ์ง€์ ์˜ ํ˜ธ์ถœ ์ฃผ์†Œ ๋‚ด๋ถ€์— ์žˆ๋‹ค.
  • ํŒŒ์ผ์ด ์•…์„ฑ ํ–‰์œ„๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” "%WINDIR%\drivers" ๊ฒฝ๋กœ์— ์œ„์น˜ํ•ด ์žˆ์–ด์•ผ ํ•˜๋Š”๋ฐ ์˜ค๋ฅธ์ชฝ ์ฝ”๋“œ๋Š” ์‹คํ–‰ ๊ฒฝ๋กœ๊ฐ€ "%WINDIR%\drivers" ์ธ์ง€ ํ™•์ธํ•˜๋Š” ์ฝ”๋“œ์ด๋‹ค.
    • ์‹คํ–‰ ๊ฒฝ๋กœ๊ฐ€ ์ผ์น˜ํ•˜๋ฉด ์กฐ๊ฑด ์ ํ”„ ์ฝ”๋“œ๋กœ ์ธํ•ด 0x0041D75C ์ง€์ ์œผ๋กœ ์ด๋™ํ•ด์„œ ์•…์„ฑ ๋™์ž‘์„ ํ•œ๋‹ค.
    • ์‹คํ–‰ ๊ฒฝ๋กœ๊ฐ€ ์ผ์น˜ํ•˜์ง€ ์•Š์œผ๋ฉด "%WINDIR%\drivers" ๊ฒฝ๋กœ์— servise.exe๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ๋ณต์ œ ํŒŒ์ผ์„ ์ƒ์„ฑ ๋ฐ ์‹คํ–‰ํ•˜๊ณ  ์•…์„ฑํ–‰์œ„๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค.

 

1.2.2 ๋™์ž‘ ์ค‘์ธ ํ”„๋กœ์„ธ์Šค ํ™•์ธ

  • servise.exe ํ”„๋กœ์„ธ์Šค ๋™์ž‘์ด ํ™•์ธ๋˜๋ฉด ์ด๋ฏธ ์•…์„ฑํŒŒ์ผ์ด ๋™์ž‘ํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ํŒ๋‹จ.
  • ์ผ๋ฐ˜์ ์œผ๋กœ ์‹คํ–‰ ์ค‘์ธ ํ”„๋กœ์„ธ์Šค์˜ ์ •๋ณด๋ฅผ ์–ป์„ ๋•Œ, CreateToolhelp32Snapshot(), Process32First(), Process32Next() API๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  CreateToohelp32Snapshot() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋™์ž‘ ์ค‘์ธ ํ”„๋กœ์„ธ์Šค๋“ค์˜ ์Šค๋ƒ…์ƒท์„ ์ฐ์„ ์ˆ˜ ์žˆ๋‹ค.
  • ๊ทธ๋ฆฌ๊ณ  ์Šค๋ƒ…์ƒท์œผ๋กœ ํ”„๋กœ์„ธ์Šค๋ฅผ ํ•˜๋‚˜์”ฉ ๊ฒ€์ƒ‰ํ•˜๋ฉด์„œ servise.exe๋ฅผ ์ฐพ์œผ๋ฉด ๋œ๋‹ค.
    • ์ด๋•Œ Process32First(), Process32Next() API๋ฅผ ์‚ฌ์šฉํ•˜๋Š”๋ฐ ๊ฐ API์˜ ์ฒซ ๋ฒˆ์งธ ์ธ์ž๋Š” CreateToolhelp32Snapshot() API ํ˜ธ์ถœ๋กœ ์–ป์€ ํ•ธ๋“ค, ๋‘ ๋ฒˆ์งธ ์ธ์ž๋Š” PROCESSENTRY32 ๊ตฌ์กฐ์ฒด ๋ณ€์ˆ˜์ด๋‹ค.
    • ์ด ๊ฐ’์„ ํ™œ์šฉํ•ด์„œ servise.exe๊ฐ€ ๋™์ž‘ํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•œ๋‹ค.

  • szExeFile[MAX_PATH] ๋ฉค๋ฒ„๋Š” ๊ฒ€์ƒ‰๋œ ํ”„๋กœ์„ธ์Šค์˜ ์ด๋ฆ„์„ ์ง€์นญํ•˜๋ฉฐ Process32First()๋‚˜ Process32Next() API๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด PROCESSENTRY32 ๊ตฌ์กฐ์ฒด ๋ณ€์ˆ˜์˜ szExeFile[MAX_PATH] ๋ฉค๋ฒ„์— ๊ฒ€์ƒ‰๋œ ํ”„๋กœ์„ธ์Šค์˜ ์ด๋ฆ„ ๋ฌธ์ž์—ด์ด ์ž…๋ ฅ๋œ๋‹ค.

  • siExeFile[MAX_PATH]์— ์ž…๋ ฅ ๋˜๋Š” ํ”„๋กœ์„ธ์Šค ์ด๋ฆ„๊ณผ "servise.exe" ๋ฌธ์ž์—ด๊ณผ ๋น„๊ตํ•ด์„œ servise.exe๊ฐ€ ๋™์ž‘ํ•˜๊ณ  ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๊ณ  ๋™์ž‘์ด ํ™•์ธ๋˜๋ฉด BL ๋ ˆ์ง€์Šคํ„ฐ์— 1์˜ ๊ฐ’์„ ์ž…๋ ฅํ•œ๋‹ค.
  • ๋ชจ๋“  ํ”„๋กœ์„ธ์Šค ๊ฒ€์ƒ‰์ด ๋๋‚˜๋ฉด BL ๊ฐ’์„ ํ™•์ธํ•ด์„œ servise.exe์˜ ์ƒ์„ฑ ๋ฐ ์‹คํ–‰์„ ๊ฒฐ์ •ํ•œ๋‹ค.


1.2.3 servise.exe ์ƒ์„ฑ ๋ฐ ์‹คํ–‰

servise.exe ์ƒ์„ฑ ์ฝ”๋“œ

  • servise.exe๋Š” Challenge 02.exe์˜ ๋ณต์ œ๋ณธ
  • ์ฝ”๋“œ๊ฐ€ ๋™์ž‘ํ•˜๋ฉด "%WINDIR%\drivers" ๊ฒฝ๋กœ์— service.exe๊ฐ€ ๋งŒ๋“ค์–ด์ง„๋‹ค.

  • Challenge 02.exe๋Š” SetFileAttributesA() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ servise.exe๋ฅผ ์ˆจ๊น€ ํŒŒ์ผ๋กœ ๋ณ€๊ฒฝํ•œ๋‹ค.

  • ์ž๋™ ์‹คํ–‰ ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๋“ฑ๋ก ์ฝ”๋“œ๋กœ ์ธํ•ด servise.exe๊ฐ€ ์ž๋™ ์‹คํ–‰ ๋“ฑ๋ก๋˜๊ณ  ๊ฐ์—ผ PC๊ฐ€ ๋ถ€ํŒ…๋  ๋•Œ๋งˆ๋‹ค servise.exe๊ฐ€ ๋™์ž‘ํ•œ๋‹ค.
  • ์ด ๋ชจ๋“  ๊ณผ์ •์ด ์™„๋ฃŒ๋˜๋ฉด Challenge 02.exe๋Š” ShellExecuteA() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ servise.exe๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.

1.3 servise.exe ๋ถ„์„

1.3.1 Thread Code ์‹คํ–‰

  • servise.exe๋Š” CreateThread() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ 0x00404A88 ์ง€์ ์˜ ์Šค๋ ˆ๋“œ ์ฝ”๋“œ๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.
  • ํ”Œ๋ž˜๊ทธ ๊ฐ’์ธ CREATE_SUSPENDED๋กœ ์ธํ•ด ์‹ค์ œ ํ˜ธ์ถœ์€ ResumeThread()์—์„œ ์ด๋ฃจ์–ด์ง„๋‹ค.
  • ์ฃผ์š” ์•…์„ฑํ–‰์œ„๋Š” ๋ชจ๋‘ ์Šค๋ ˆ๋“œ ์•ˆ์—์„œ ์ด๋ฃจ์–ด์ง€๊ธฐ ๋•Œ๋ฌธ์— ์Šค๋ ˆ๋“œ ์ฝ”๋“œ๊ฐ€ ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”์ง€ ํŒŒ์•…ํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”.

1.3.2 Virtual Key ์„ค์ • ๋ณ€๊ฒฝ

  • ์Šค๋ ˆ๋“œ๋ฅผ ํ˜ธ์ถœํ•˜๊ณ  ๋‚˜๋ฉด ํŠน์ • ํ‚ค์˜ ์„ค์ •์„ ๋ณ€๊ฒฝํ•ด์„œ ๋ˆŒ๋ €์„ ๋•Œ ์†Œ๋ฆฌ๊ฐ€ ๋‚˜๊ฒŒ ํ•œ๋‹ค.
  • GetAsyncKeyState()๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํ‚ค์˜ ์ƒํƒœ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.
  • ์‚ฌ์šฉ์ž๊ฐ€ ํŠน์ • ํ‚ค๋ฅผ ๋ˆ„๋ฅด๋ฉด PlaySoundA()๊ฐ€ ํ˜ธ์ถœ๋˜๊ณ  ์‚ฌ์šด๋“œ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค. ๋‹ค์Œ์€ VK_RETURN ํ‚ค์˜ ์†Œ๋ฆฌ ์„ค์ •์„ ๋ณด์—ฌ์ค€๋‹ค.
  • JUMP ์ฝ”๋“œ๋กœ ์ธํ•ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์‹คํ–‰๋œ๋‹ค.

1.3.3. Thread Code

1. logo.scr ํŒŒ์ผ ์ƒ์„ฑ ๋ฐ ํ™”๋ฉด ๋ณดํ˜ธ ์„ค์ • ๋ณ€๊ฒฝ

  • servise.exe๋Š” ํ™”๋ฉด ๋ณดํ˜ธ ๋ชจ๋“œ์—์„œ๋„ ์•…์ƒํ–‰์œ„๋ฅผ ๋ฐœ์ƒ์‹œํ‚ค๊ธฐ ์œ„ํ•ด, 'ํ™”๋ฉด ๋ณดํ˜ธ ๋ชจ๋“œ์šฉ'์œผ๋กœ logo.scr์„ ๋งŒ๋“ ๋‹ค.
  • logo.scr ํŒŒ์ผ์€ servise.exe์˜ ๋ณต์ œ ํŒŒ์ผ๋กœ "%WINDIR%"์— ์ƒ์„ฑ๋œ๋‹ค.

  • logo.scr ํŒŒ์ผ์ด ๋™์ž‘ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํ™”๋ฉด ๋ณดํ˜ธ ๋ชจ๋“œ๊ฐ€ ํ™œ์„ฑํ™”๋˜์–ด์•ผ ํ•˜๊ณ  SystemParametersInfoA() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ณดํ˜ธ ๋ชจ๋“œ ๋ฐ ํ™œ์„ฑ ์‹œ๊ฐ„ ์„ค์ •์„ ํ•  ์ˆ˜ ์žˆ๋‹ค.

  • ๋งˆ์ง€๋ง‰์œผ๋กœ ํ™”๋ฉด ๋ณดํ˜ธ ๋ชจ๋“œ์—์„œ ์‹คํ–‰๋˜๋Š” ํŒŒ์ผ์„ logo.scr๋กœ ์ง€์ •ํ•˜๋ฉด ์„ค์ • ๋ณ€๊ฒฝ์ด ์™„๋ฃŒ๋˜๋Š”๋ฐ ์ด๋•Œ "HKEY_CURRENT_USER\Control Panel\Desktop" ํ‚ค์˜ SCANSAVE.EXE ๊ฐ’์„ ์ˆ˜์ •ํ•˜๋ฉด ๋œ๋‹ค.


2. XXX.scr ํŒŒ์ผ ์ƒ์„ฑ

  • logo.scr ํŒŒ์ผ์„ ๋งŒ๋“ค๊ณ  ๋‚˜๋ฉด "C:\WINDOWS\system32\drivers\Cache" ๊ฒฝ๋กœ์— XXX.scr ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค.
  • ์ด ํŒŒ์ผ๋„ servise.exe์˜ ๋ณต์ œ๋ณธ์ด๋‹ค.

 

 


3. servise.exe ํŒŒ์ผ ์™ธ๋ถ€ ์นจ์ž… ๋ณดํ˜ธ

  • servise.exe๋Š” LockFileEx() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๋‹ค๋ฅธ ์Šค๋ ˆ๋“œ๋‚˜ ํ”„๋กœ์„ธ์Šค๊ฐ€ ์ž์‹ ์—๊ฒŒ ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ์„ ๋ง‰๋Š”๋‹ค.


4. ๋ถ„์„ Tool ๊ฐ•์ œ ์ข…๋ฃŒ

  • ์•…์„ฑํŒŒ์ผ์„ ๋ถ„์„ํ•  ๋•Œ ์‚ฌ์šฉํ•˜๋Š” Tool์— ๋Œ€ํ•œ ๋ฌด๋ ฅํ™” ๊ธฐ๋Šฅ๋„ ์žˆ๋‹ค.

  • procexp.exe๋ฅผ ์ฐพ์•„์„œ ๊ฐ•์ œ ์ข…๋ฃŒ์‹œํ‚ค๋Š” ์ฝ”๋“œ๋กœ ๋ฌธ์ž์—ด์„ ๋น„๊ตํ•ด์„œ ํƒ€๊นƒ ํ”„๋กœ์„ธ์Šค๋ฅผ ์ฐพ๊ณ , TerminateProcess() API๋ฅผ ์‚ฌ์šฉํ•ด์„œ ๊ฐ•์ œ ์ข…๋ฃŒ์‹œํ‚จ๋‹ค.
  • TerminateProcess() API์˜ ์ธ์ž๋กœ ๋“ค์–ด๊ฐ€๋Š” ํ•ธ๋“ค ๊ฐ’์€ OpenProcess() API๋ฅผ ํ˜ธ์ถœํ•ด์„œ ์–ป์„ ์ˆ˜ ์žˆ๋‹ค.
  • OpenProcess()๋ฅผ ํ˜ธ์ถœํ•  ๋•Œ ํ•„์š”ํ•œ PID ๊ฐ’์€ PROCESSENTRY32 ๊ตฌ์กฐ์ฒด์˜ th32ProcessID ๋ฉค๋ฒ„๋ฅผ ํ™œ์šฉํ•œ๋‹ค.


5. ํŠน์ • ์œˆ๋„์šฐ ๊ฐ•์ œ ์ข…๋ฃŒ

  • FindWindow() API๋กœ ํƒ€๊นƒ ํ”„๋กœ์„ธ์Šค์˜ ๋™์ž‘์„ ํ™•์ธํ•˜๊ณ  ํ•ธ๋“ค ๊ฐ’๊ณผ PID๋ฅผ ์•Œ์•„๋‚ธ ๋’ค์— TerminateProcess()๋ฅผ ํ˜ธ์ถœํ•œ๋‹ค.

6. ์‹œ์Šคํ…œ ์„ค์ • ๋ณ€๊ฒฝ

  • ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์˜ ํŠน์ • ๊ฐ’์„ ์ˆ˜์ •ํ•ด์„œ ์‹œ์Šคํ…œ ์„ค์ •์„ ๋ฐ”๊พผ๋‹ค.
  • ์ž๊ธฐ ๋ณดํ˜ธ ๋ฐ ๋ถ„์„์„ ์–ด๋ ต๊ฒŒ ํ•˜๊ธฐ ์œ„ํ•œ ๋™์ž‘์ด๋‹ค.
  • ๋‹ค์Œ์€ "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" ํ‚ค์˜ Hidden ๊ฐ’์„ ์ˆ˜์ •ํ•˜๋Š” ๊ณผ์ •์ด๋‹ค.

  • ์ด ์™ธ์—๋„ ๋‹ค์–‘ํ•œ ๊ฐ’๋“ค์ด ๋ณ€๊ฒฝ๋œ๋‹ค.
  • ๋‹ค์Œ์€ ๋ณดํ˜ธ๋œ ์šด์˜์ฒด์ œ ํŒŒ์ผ ์ˆจ๊ธฐ๊ธฐ ์„ค์ •์„ ํ•ด์ œํ•˜๋Š” ๊ณผ์ •์ด๋‹ค.

  • ๋‹ค์Œ์€ ํŒŒ์ผ ํ™•์žฅ์ž ๋ณด์ด๊ธฐ์— ๋Œ€ํ•œ ์„ค์ •์„ ํ•ด์ œํ•˜๋Š” ๊ณผ์ •์ด๋‹ค.

  • ๋‹ค์Œ์€ ์œˆ๋„์šฐ ํƒ์ƒ‰๊ธฐ์˜ ๋„๊ตฌ์—์„œ ํด๋” ์˜ต์…˜ ํ•ญ๋ชฉ์„ ๋น„ํ™œ์„ฑํ™”ํ•˜๋Š” ๊ณผ์ •์ด๋‹ค.

  • '1.3.3 Thread Code' ๋™์ž‘์€ JUMP ์ฝ”๋“œ๋กœ ์ธํ•ด ๊ณ„์† ๋ฐ˜๋ณต๋œ๋‹ค. 
  • ๊ทธ ๊ฒฐ๊ณผ ๋ถ„์„ Tool ๋ฌด๋ ฅํ™” ๋ฐ ์‹œ์Šคํ…œ ์„ค์ • ๋ณ€๊ฒฝ ๋“ฑ์˜ ๋™์ž‘์ด ์‹ค์‹œ๊ฐ„์œผ๋กœ ์ด๋ฃจ์–ด์ง„๋‹ค.
728x90

1. ์–ธ์–ด ์„ ํƒ ๋ฐ ์ฝ”๋“œ ์ž‘์„ฑ ๋ฐฉ์‹

  • Win32 API๋กœ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๋ถ„์„.
  • ์ž‘์„ฑํ•  ์ฝ”๋“œ๋Š” ๋ชจ๋‘ main() ํ•จ์ˆ˜์— ์žˆ๋‹ค.

2. ํŒŒ์ผ ๊ฒ€์ƒ‰, ๊ด€๋ฆฌ ์ฝ”๋“œ

2.1 ๋™์ž‘ ํ™•์ธ

  1. ๋™์ผ ๊ฒฝ๋กœ์— Sample 01.exe๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธ
  2. Sample 01.exe ํŒŒ์ผ ๋ฐ์ดํ„ฐ๋ฅผ ํš๋“
  3. Sample 01.exe ํŒŒ์ผ์„ ์‚ญ์ œ
  4. "%TEMP%" ๊ฒฝ๋กœ๊ฒŒ Replicated Sample 01.exe๋ผ๋Š” ์ด๋ฆ„์œผ๋กœ ์ƒˆ๋กœ์šด ํŒŒ์ผ์„ ์ƒ์„ฑ
  5. Replicated Sample 01.exe์— Sample 01.exe ํŒŒ์ผ ๋ฐ์ดํ„ฐ๋ฅผ ๊ธฐ๋ก
  6. Replicated Sample 01.exe๋ฅผ ์‹คํ–‰

2.2 ์ฝ”๋“œํ•™์Šต

1. ํŒŒ์ผ ๋ณต์ œ ์ฝ”๋“œ ๊ธฐ๋ณธ ๊ตฌ์„ฑ

  • ํŒŒ์ผ ๋ฐ์ดํ„ฐ๋ฅผ ์ฝ๊ฑฐ๋‚˜ ์“ฐ๊ธฐ ์œ„ํ•ด์„œ๋Š” ํŒŒ์ผ์„ ์—ด์–ด์•ผ ํ•˜๋Š” ๋ฐ ์ด๋•Œ ํ•„์š”ํ•œ API๋Š” CreateFile()
  • CreateFile()์€ ํŒŒ์ผ์„ ์ƒˆ๋กœ ๋งŒ๋“ค๊ฑฐ๋‚˜ ๊ธฐ์กด ํŒŒ์ผ์„ ์—ด ์ˆ˜ ์žˆ๋‹ค.

  • ์ฒซ ๋ฒˆ์งธ ์ธ์ž๋Š” ์ƒ์„ฑ ๋˜๋Š” ์—ด๊ณ ์ž ํ•˜๋Š” ํŒŒ์ผ์˜ ๊ฒฝ๋กœ ๊ฐ’
    • Sample05.exe๋Š” ํ˜„์žฌ ๊ฒฝ๋กœ์— ์œ„์น˜ํ•œ Sample01.exe๋ฅผ ๋ณต์ œํ•ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์— %guswo rudfh%\Sample01.exe๊ฐ€ ๋“ค์–ด๊ฐ€์•ผ ํ•œ๋‹ค.
    • ํ˜„์žฌ ๊ฒฝ๋กœ๋Š” Sample05.exe์˜ ์œ„์น˜์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์ง€๋ฉฐ CreateFile() API๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์ด์ „์— ํ˜„์žฌ ๊ฒฝ๋กœ๋ฅผ ์•Œ์•„๋‚ผ ํ•„์š”๊ฐ€ ์žˆ๋‹ค.
    • GetCurrentDirectory() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ํ˜„์žฌ ๊ฒฝ๋กœ ๊ฐ’์„ ์–ป์„ ์ˆ˜ ์žˆ๊ณ  ์—ฌ๊ธฐ์— \Sample01.exe ๋ฌธ์ž์—ด์„ ๋”ํ•ด์ฃผ๋ฉด ์ ˆ๋Œ€ ๊ฒฝ๋กœ๊ฐ€ ์™„์„ฑ๋œ๋‹ค.
  • ๋‘ ๋ฒˆ์งธ ์ธ์ž(Generic_Read)๋Š” ํ•ด๋‹น ํŒŒ์ผ์„ ์–ด๋–ค ์šฉ๋„๋กœ ์“ธ ๊ฒƒ์ธ์ง€์— ๋Œ€ํ•œ ๊ถŒํ•œ ์ •๋ณด
  • ๋‹ค์„ฏ ๋ฒˆ์งธ ์ธ์ž(OPEN_EXISTING)์€ ๋™์ผํ•œ ๊ฒฝ๋กœ์— Sample01.exe๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ์— ์—ด๊ฒ ๋‹ค๋Š” ์˜๋ฏธ
    • ํŒŒ์ผ์ด ์—†์œผ๋ฉด ํ˜ธ์ถœ์ด ์‹คํŒจ๋กœ ๋๋‚œ๋‹ค.

  • ํŒŒ์ผ์„ ์—ด์—ˆ์œผ๋‹ˆ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์™€์•ผ ํ•˜๋Š”๋ฐ ReadFile() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.

  • ์ฒซ ๋ฒˆ์งธ ์ธ์ž๋Š” Sample01.exe์˜ ํ•ธ๋“ค ๊ฐ’์ด๋‹ค.
    • ํ•ธ๋“ค: exe๋Š” ํ–‰์œ„๊ฐ€ ๋ฐœ์ƒํ•˜๋„๋ก ์š”์ฒญํ•˜๋Š” ๊ฒƒ์ธ๋ฐ exe๊ฐ€ ์–ด๋–ค ํ–‰์œ„๋ฅผ ์š”์ฒญํ•  ๋•Œ๋Š” ๋ชฉ์ ์„ ๋ฐํžˆ๊ณ  ๊ด€๋ฆฌ์ž์—๊ฒŒ ํ—ˆ๋ฝ์„ ๋ฐ›์•„์•ผ ํ•œ๋‹ค. ์—ฌ๊ธฐ์„œ CreateFile() API ํ˜ธ์ถœ์ด ํŠน์ • ํ–‰์œ„์— ๋Œ€ํ•œ ์š”์ฒญ์ด๋ฉฐ ์š”์ฒญ ์Šน์ธ์— ๋Œ€ํ•œ ์ง•ํ‘œ๊ฐ€ ํ•ธ๋“ค์ด๋‹ค.
  • ๋‘ ๋ฒˆ์งธ, ์„ธ ๋ฒˆ์งธ ์ธ์ž๋Š” '์ฝ์–ด์˜ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ์œ„์น˜ ์ฃผ์†Œ'์™€ '์ฝ์–ด์˜ฌ ๋ฐ์ดํ„ฐ์˜ ํฌ๊ธฐ'์ด๋‹ค.
    • ReadFile() API๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์ „์— ์ฝ์–ด ์˜ฌ ๋ฐ์ดํ„ฐ์˜ ํฌ๊ธฐ๋ฅผ ๊ตฌํ•˜๊ณ  ์ €์žฅ ๊ณต๊ฐ„์„ ํ• ๋‹นํ•ด์•ผ ํ•œ๋‹ค.
    • GetFileSize() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด Sample01.exe์˜ ํฌ๊ธฐ๋ฅผ ๊ตฌํ•  ์ˆ˜ ์žˆ๋‹ค.
    • ๊ทธ๋ฆฌ๊ณ  malloc() ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๊ทธ ํฌ๊ธฐ๋งŒํผ ๋ฉ”๋ชจ๋ฆฌ ๊ณต๊ฐ„์„ ํ• ๋‹นํ•  ์ˆ˜ ์žˆ๋‹ค.
    • ๊ฐ๊ฐ์— ๋Œ€ํ•œ ๊ฒฐ๊ณผ ๊ฐ’์„ ReadFile() API์˜ ์ธ์ž๋กœ ๋„ฃ๊ณ  ํ˜ธ์ถœํ•˜๋ฉด 'IpBuffer'์— Sample01.exe ํŒŒ์ผ ๋ฐ์ดํ„ฐ๊ฐ€ ์ €์žฅํ•˜๊ณ  ๋‚˜์„œ ํ•ธ๋“ค์€ ๋ฐ˜ํ™˜๋œ๋‹ค.

  • Sample01.exe๋„ ์‚ญ์ œํ•œ๋‹ค.
  • ์ด์ œ "%TEMP%" ๊ฒฝ๋กœ์— Replicated Sample 01.exe๋ฅผ ๋งŒ๋“œ๋กœ 'IpBuffer'์— ์ €์žฅ๋˜์–ด ์žˆ๋Š” Sample01.exe ํŒŒ์ผ ๋ฐ์ดํ„ฐ๋ฅผ ์จ์•ผ ํ•œ๋‹ค.
  • CreateFile() API๋ฅผ ํ˜ธ์ถœํ•˜๊ธฐ ์ „์— "%TEMP%\Replicated Sample 01.exe" ๊ฒฝ๋กœ ๋ฌธ์ž์—ด์„ ๋จผ์ € ๋งŒ๋“ค์–ด์ฃผ๊ณ  GetTempPath()์™€ wsprintf() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.
  • CreateFile() API์˜ ๋‘ ๋ฒˆ์งธ, ๋‹ค์„ฏ ๋ฒˆ์งธ ์ธ์ž์—๋Š” 'GENERIC_WRITE'์™€ 'CREATE_NEW'๋ฅผ ๋„ฃ์—ˆ๋Š” ๋ฐ ์ด๋Š” 'Sample 01.exe ํŒŒ์ผ ๋ฐ์ดํ„ฐ๋ฅผ ์“ฐ๊ธฐ ์œ„ํ•ด Replicated Sample 01.exe๋ฅผ ์ƒˆ๋กœ ๋งŒ๋“ ๋‹ค.'๋Š” ์˜๋ฏธ.
  • WriteFile() API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ฝ์–ด ๋“ค์ธ ํŒŒ์ผ ๋ฐ์ดํ„ฐ๋ฅผ ๋ณต์ œํ•œ exeํŒŒ์ผ์— ๊ธฐ๋ก.

  • ์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ํŒŒ์ผ ๋ณต์ œ๊ฐ€ ๋๋‚ฌ๊ณ  Replicated Sample 01.exe๋ฅผ ์‹คํ–‰ํ•˜๋ฉด Sample 05.exe์˜ ๋™์ž‘์ด ์™„๋ฃŒ๋œ๋‹ค.

2. ํŒŒ์ผ ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ ์ถ”๊ฐ€

: Sample 05.exe๊ฐ€ ์ž์ฒด์ ์œผ๋กœ Sample 01.exe์˜ ์กด์žฌ ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•˜๊ณ  ํŒŒ์ผ ๋ณต์ œ ๋™์ž‘์„ ํ•˜๋„๋ก ๋งŒ๋“œ๋Š” ๊ฒƒ.

  • ํŒŒ์ผ ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ฉด ํŠน์ • ๊ฒฝ๋กœ์— ์žˆ๋Š” ํŒŒ์ผ๋“ค์„ ํƒ์ƒ‰ํ•˜๊ณ  ์ •๋ณด ์ˆ˜์ง‘์ด ๊ฐ€๋Šฅ.
  • ํŒŒ์ผ์ด๋‚˜ ํด๋”๋ฅผ ๊ฒ€์ƒ‰ํ•  ๋•Œ FindFirstFile(), FindNextFile() API๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
    • FindFirstFile() API ์ฒซ ๋ฒˆ์งธ ์ธ์ž์—๋Š” ๊ฒ€์ƒ‰ํ•˜๊ณ ์ž ํ•˜๋Š” ๊ฒฝ๋กœ ๊ฐ’์ด ๋“ค์–ด๊ฐ€๋Š”๋ฐ ๊ฒ€์ƒ‰ ๋Œ€์ƒ์ด ๋ชจ๋“  ํŒŒ์ผ๊ณผ ํด๋”์ด๊ธฐ ๋•Œ๋ฌธ์— "%ํ˜„์žฌ ๊ฒฝ๋กœ%\*.*" ๋ฌธ์ž์—ด์„ ๋งŒ๋“ค์–ด์ฃผ๋ฉด ๋œ๋‹ค.
    • *์€ ๋ชจ๋“  ๋ฌธ์ž์—ด์„ ์˜๋ฏธํ•˜๊ณ  ๊ฒ€์ƒ‰ ๋Œ€์ƒ์ด ๋ชจ๋“  exe ํŒŒ์ผ์ด๋ฉด, *. exe๋ฅผ ๋„ฃ์–ด์ฃผ๋ฉด ๋œ๋‹ค.

  • ๊ฒ€์ƒ‰ ๊ฒฝ๋กœ๋ฅผ ์™„์„ฑํ•˜๋ฉด ํŒŒ์ผ ๊ฒ€์ƒ‰์„ ํ•ด์•ผ ํ•˜๋Š”๋ฐ FindFirstFile() API์˜ ์ฝ”๋“œ์— ์ฒซ ๋ฒˆ์งธ ์ธ์ž์—๋Š” ์™„์„ฑ๋œ ๊ฒฝ๋กœ ๊ฐ’์„ ๋„ฃ๊ณ , ๋‘ ๋ฒˆ์งธ ์ธ์ž์—๋Š” WIN32_FIND_DATA ๊ตฌ์กฐ์ฒด ๋ณ€์ˆ˜๋ฅผ ์ง€์ •ํ•ด ๋„ฃ์œผ๋ฉด ๋œ๋‹ค.

  • ๊ตฌ์กฐ์ฒด๋„ ๋ณ€์ˆ˜์™€ ๋น„์Šทํ•˜๊ฒŒ ๊ฐ’์„ ๋‹ด์„ ์ˆ˜ ์žˆ๋Š” ์ฃผ๋จธ๋‹ˆ๋กœ ๋ณ€์ˆ˜์™€ ๋‹ฌ๋ฆฌ ๊ตฌ์กฐ๊ฐ€ ์ •ํ•ด์ ธ ์žˆ๊ณ , ๊ทธ ์•ˆ์—๋Š” ์•ฝ์†๋œ ๊ฐ’์ด ๊ธฐ๋ก๋œ๋‹ค.

  • FindFirstFile()์„ ํ˜ธ์ถœํ•˜๋ฉด ์ฒ˜์Œ์œผ๋กœ ์ฐพ์€ ํŒŒ์ผ์˜ ์ •๋ณด๊ฐ€ WIN32_FIND_DATA ๊ตฌ์กฐ์ฒด ๋ณ€์ˆ˜์ธ 'FileData'์— ๊ธฐ๋ก.
  • WIN32_FIND_DATA ๊ตฌ์กฐ์ฒด์˜ cFileName ๋ฉค๋ฒ„๋Š” ๊ฒ€์ƒ‰ ํŒŒ์ผ์˜ ์ด๋ฆ„ ์ •๋ณด์ด๋ฉฐ ์ด ์ •๋ณด๋ฅผ ๊ฐ€์ง€๊ณ  ๋ฌธ์ž์—ด์„ ๋น„๊ตํ•ด์„œ Sample 01.exe๊ฐ€ ๋งž๋Š”์ง€ ํ™•์ธ.
  • ๋งŒ์•ฝ์— ์•„๋‹ˆ๋ฉด FindNextFile() API๋ฅผ ํ˜ธ์ถœํ•ด์„œ ๋‹ค์Œ ํŒŒ์ผ์„ ๊ฒ€์ƒ‰ํ•˜๊ณ  ์ฐพ์œผ๋ฉด ํŒŒ์ผ ๋ณต์ œ ์ฝ”๋“œ๊ฐ€ ์‹คํ–‰๋˜๋ฉฐ ์ด ์ž‘์—…์€ ํ˜„์žฌ ๊ฒฝ๋กœ์— ์žˆ๋Š” ๋ชจ๋“  ํŒŒ์ผ, ํด๋” ๊ฒ€์ƒ‰์ด ๋๋‚  ๋•Œ๊นŒ์ง€ ๋ฐ˜๋ณต๋œ๋‹ค. 

2.3 ํŒŒ์ผ ๋ถ„์„


3. ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ๊ด€๋ฆฌ ์ฝ”๋“œ

3.1 ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ

:๋ ˆ์ง€์ŠคํŠธ๋ฆฌ๋Š” ์ผ์ข…์˜ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋กœ Windows ์‹œ์Šคํ…œ ์ •๋ณด์™€ ํ•จ๊ป˜ ๋™์ž‘์— ํ•„์š”ํ•œ ๋‹ค์–‘ํ•œ ์ •๋ณด๋“ค์ด ๊ธฐ๋ก.

 

1. Key

๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์—์„œ ํด๋”์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•˜๋Š” ๊ฐœ๋….

ํด๋”์— ํ•˜์œ„ ํด๋” ๋ฐ ํŒŒ์ผ๋“ค์ด ๋“ค์–ด๊ฐˆ ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์ฒ˜๋Ÿผ ํ•˜์œ„ ํ‚ค์™€ Value๋ฅผ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋‹ค.

 

2. Root Key

: ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์˜ ์ตœ์ƒ์œ„ ํ‚ค

HKEY_CLASSES_ROOT ํŒŒ์ผ ํ™•์žฅ์ž์™€ ํ™•์žฅ์ž๊ฐ€ ์‚ฌ์šฉํ•  ํ”„๋กœ๊ทธ๋žจ์˜ ๋งคํ•‘ ์ •๋ณด๊ฐ€ ์ •์˜๋˜์–ด ์žˆ๋‹ค.
HKEY_CURRENT_USER ํ˜„์žฌ ์‹œ์Šคํ…œ์— ๋กœ๊ทธ์˜จํ•˜๊ณ  ์žˆ๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์„ค์ •ํ•œ ์‹œ์Šคํ…œ ํ™˜๊ฒฝ ์ •๋ณด(๋„คํŠธ์›Œํฌ, ์‘์šฉ ํ”„๋กœ๊ทธ๋žจ ๋“ฑ์˜ ์ •๋ณด)๊ฐ€ ์ •์˜๋˜์–ด ์žˆ๋‹ค.
HKEY_LOCAL_MACHINE ์‹œ์Šคํ…œ์˜ ํ•˜๋“œ์›จ์–ด ๊ตฌ์„ฑ์— ํ•„์š”ํ•œ ์ดˆ๊ธฐํ™” ํŒŒ์ผ๊ณผ ์†Œํ”„ํŠธ์›จ์–ด ์ •๋ณด, ๋“œ๋ผ์ด๋ฒ„ ์ •๋ณด ๋“ฑ์ด ์ •์˜๋˜์–ด ์žˆ๋‹ค.
HKEY_USER ์‹œ์Šคํ…œ์•  ์žˆ๋Š” ๋ชจ๋“  ๊ณ„์ •๊ณผ ๊ทธ๋ฃน์— ๋Œ€ํ•œ ์‹œ์Šคํ…œ ํ™˜๊ฒฝ ์ •๋ณด๊ฐ€ ์ •์˜๋˜์–ด ์žˆ๋‹ค.
HKEY_CURRENT_CONFIG ์‹œ์Šคํ…œ์ด ๋ถ€ํŒ… ์‹œ ์‚ฌ์šฉํ•˜๋Š” ํ•˜๋“œ์›จ์–ด ํ”„๋กœํŒŒ์ผ ์ •๋ณด(๊ธ€๊ผด, ํ”„๋ฆฐํ„ฐ ์ •๋ณด ๋“ฑ์˜ ๋ถ€๊ฐ€์  ์ •๋ณด)๊ฐ€ ์ •์˜๋˜์–ด ์žˆ๋‹ค.

 

3. Value

ํด๋”์— ์†ํ•œ ํŒŒ์ผ์ฒ˜๋Ÿผ Key ์•ˆ์— ์กด์žฌํ•œ๋‹ค.

Type Description Type Description
REG_SZ ๋ฌธ์ž์—ด ๊ฐ’ REG_BINARY ์ด์ง„๊ฐ’
REG_MULTI_SZ ๋‹ค์ค‘ ๋ฌธ์ž์—ด ๊ฐ’ REG_DWORD DWORD ๊ฐ’
REG_EXPAND_SZ ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ๋ฌธ์ž์—ด ๊ฐ’ RGE_QWORD QWORD ๊ฐ’

 

4. Data

Value๊ฐ€ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ๋ฐ์ดํ„ฐ.

Value์˜ Type์— ๋”ฐ๋ผ ๋ฌธ์ž์—ด ๋ฐ ์ด์ง„ ๊ฐ’ ๋“ฑ์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๋‹ค.


๋ ˆ์ง€์ŠคํŠธ๋ฆฌ ์‹ค์Šต

3.2 ๋™์ž‘ ํ™•์ธ


3.3 ์ฝ”๋“œ ํ•™์Šต

  • ๋ ˆ์ง€์ŠคํŠธ๋ฆฌ์˜ Value๋ฅผ ๋“ฑ๋ก, ์กฐํšŒ, ์ˆ˜์ •ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” Key๋ฅผ ์—ด์–ด์ค˜์•ผ ํ•œ๋‹ค.
  • RegOpenKeyEx() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋˜๋Š”๋ฐ Key์— ๋Œ€ํ•œ ํ•ธ๋“ค ๊ฐ’์€ ๋‹ค์„ฏ ๋ฒˆ์งธ ์ธ์ž์ธ hKey์— ๋“ค์–ด๊ฐ„๋‹ค.

  • Key๋ฅผ ์—ด์—ˆ์œผ๋ฉด Value๋ฅผ ๋“ฑ๋กํ•˜๋ฉด ๋˜๋Š” ๋ฐ ๋ฐ”๋กœ ๋“ฑ๋ก์„ ํ•ด์ค˜๋„ ๋ฌด๋ฐฉํ•˜์ง€๋งŒ ์—ฌ๊ธฐ์„œ๋Š” 'Run_Sample'์ด๋ผ๋Š” ์ด๋ฆ„์˜ Value๊ฐ€ ์žˆ์„ ์ˆ˜๋„ ์žˆ๋‹ค๋Š” ๊ฐ€์ •ํ•˜์— ๋™์ผ Value๋ฅผ ๊ฒ€์ƒ‰ ๋ฐ ์‚ญ์ œํ•˜๋Š” ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ–ˆ์Šต๋‹ˆ๋‹ค.

  • RegEnumValue()๋Š” Value๋ฅผ ์กฐํšŒํ•   ๋•Œ ์‚ฌ์šฉํ•˜๋Š” API๋กœ ๋‘ ๋ฒˆ์งธ ์ธ์ž๋Š” ์กฐํšŒํ•˜๊ณ ์ž ํ•˜๋Š” Value์˜ ๋ฒˆํ˜ธ์ด๋‹ค.
  • 0๋ถ€ํ„ฐ ๊ฐ’์„ ์ฆ๊ฐ€์‹œํ‚ค๋ฉด์„œ Run Key์— ์กด์žฌํ•˜๋Š” ๋ชจ๋“  Value๋ฅผ ๊ฒ€์ƒ‰ํ•˜๋„๋ก ์ž‘์„ฑํ•œ ๊ฒƒ์ด๋‹ค.
  • RegEnumValue()๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด 'IpValue'์— ๊ฒ€์ƒ‰๋œ Value์˜ ์ด๋ฆ„ ์ •๋ณด๊ฐ€ ๋“ค์–ด๊ฐ„๋‹ค.
    • ์ด ๊ฐ’๊ณผ 'Run_Sample' ๋ฌธ์ž์—ด์„ ๋น„๊ตํ•˜๋ฉด ๋™์ผํ•œ ์ด๋ฆ„์˜ Value๊ฐ€ ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  ๊ทธ ๊ฒฐ๊ณผ์— ๋”ฐ๋ผ RegDeleteValue() API๋ฅผ ํ˜ธ์ถœํ•ด์„œ Value๋ฅผ ์‚ญ์ œํ•˜๋„๋ก ์ž‘์„ฑ.

  • Sample 01.exe๊ฐ€ ์ž๋™ ์‹คํ–‰๋˜๋„๋ก Value๋ฅผ ๋“ฑ๋กํ•˜๋ฉด ๋˜๋Š”๋ฐ ์ด๋•Œ RegSetValueEx() API๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.
  • ๋‹ค์„ฏ ๋ฒˆ์งธ ์ธ์ž๋Š” Data๋ฅผ ์˜๋ฏธํ•œ๋‹ค.
  • IpSamplePath ๋ณ€์ˆ˜์—๋Š” Sample 01.exe ๊ฒฝ๋กœ ๊ฐ’์ด ๋“ค์–ด๊ฐ€ ์žˆ๋‹ค.
  • ์—ฌ์„ฏ ๋ฒˆ์งธ ์ธ์ž๋Š” Data ํฌ๊ธฐ ๊ฐ’์ด๋‹ค.
  • Value ๋“ฑ๋ก์ด ๋๋‚˜๋ฉด RegCloseKey()๋ฅผ ํ˜ธ์ถœํ•ด์„œ ํ•ธ๋“ค ๊ฐ’์„ ๋ฐ˜ํ™˜ํ•œ๋‹ค.

  • Sample 01.exe์˜ ์ž๋™ ์‹คํ–‰ ๋“ฑ๋ก์ด ์™„๋ฃŒ๋˜์—ˆ์œผ๋ฉฐ ์žฌ๋ถ€ํŒ… ๊ฒฝ๊ณ  ๋ฉ”์‹œ์ง€๋ฅผ ์ถœ๋ ฅํ•˜๊ณ  CMD ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•ด์„œ ์šด์˜์ฒด์ œ๋ฅผ ์žฌ๋ถ€ํŒ…ํ•˜๋ฉด Sample 06.exe์˜ ๋™์ž‘์€ ์™„๋ฃŒ๋œ๋‹ค.

3.4 ํŒŒ์ผ ๋ถ„์„

 

 

 

 

 

 

 

 

+ Recent posts