# The Watchdog

We have noticed in many post-exploitation frameworks that persistence access is a recurring weakness. The issue remains by design in their single-process execution model.\
\
This could become a real problem if the target (victim) process is terminated due to a crash, service restart, or defensive interaction, resulting in recovery, if even possible, depending on external persistence mechanisms or manual redeployment.\
\
This problem is technically solved in Control Pack C2. And the approach we adopted is a dual-process supervision model, which we called "The Watchdog", and this is how it works:\
\
1\. First, Stage 2 must be enabled:

<figure><img src="https://1112023788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MU9W-baGw5TeUzNXoyo%2Fuploads%2FjkDjWNPbRLuWLK9d6vz6%2FScreenshot%20From%202026-02-24%2016-20-01.png?alt=media&#x26;token=a2b73449-e97d-427b-b0d6-2174ecec56c3" alt=""><figcaption></figcaption></figure>

2. Then, deploy the Watchdog. An execution thread with the Control Pack agent is injected in real-time into a legitimate running service

<figure><img src="https://1112023788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MU9W-baGw5TeUzNXoyo%2Fuploads%2FUr94l9ivOVYPl7DCfQ8c%2FScreenshot%20From%202026-02-24%2016-20-25.png?alt=media&#x26;token=2b5714cf-1eed-4c99-b458-8aab3b590aa2" alt=""><figcaption></figcaption></figure>

\
3\. An independent thread is then spawned (The Watchdog), linking the same process structure and monitoring the agent’s execution state:\
\- Mutual supervision between: Control Pack Agent <-> Watchdog\
\- Automatic re-establishment if either side terminates or is terminated\
\- Logging capabilities during runtime and unhooking/direct syscalling still apply while the execution remains active.

<figure><img src="https://1112023788-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MU9W-baGw5TeUzNXoyo%2Fuploads%2FQmDXwyTINdbTp3RXoAlg%2FScreenshot%20From%202026-02-24%2016-21-25.png?alt=media&#x26;token=ea4a04bc-8f56-40a9-b90d-c3559a22aac3" alt=""><figcaption></figcaption></figure>

\
Revenge: If a protection process, such as an AV or EDR (userland), successfully kills the agent thread, the watchdog fights back: It lists the process tree and active files of the offending process, killing the tree and injecting itself, when possible, as a new watchdog into the offending process, effectively running behind enemy lines.<br>
