> For the complete documentation index, see [llms.txt](https://www.pentestwiki.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.pentestwiki.com/data-theft/windows/hard-coding-credentials.md).

# Hard-coding Credentials

하드코딩된 크리덴셜 정보는 환경을 구분하지 않고 중요한 정보입니다. 의도적으로 취약하게끔 설정되어 제로데이, CVE 등을 심어둔 머신 환경들과는 다르게 실무에서는 의외로 하드코딩 된 정보, 크리덴셜 스터핑 같은 공격으로 인한 영향력이 큽니다. Windows에서는 아래와 같은 커맨드에서 탐색 입력값을 바꿈에 따라 파일을 탐색할 수 있습니다.

1. 특정 경로 하위 원하는 확장자로부터 특정 텍스트를 탐색

{% code overflow="wrap" %}

```
Get-ChildItem -Path C:\ -Recurse -Force -Include *.config,*.xml,*.ini,*.txt -ErrorAction SilentlyContinue | Select-String -Pattern "(?i)passw"
```

{% endcode %}

2. 특정한 이름의 파일의 존재를 탐색

{% code overflow="wrap" %}

```
Get-ChildItem -Path C:\ -Recurse -Force -ErrorAction SilentlyContinue -Filter "web.config"
```

{% endcode %}

3. 파워쉘 히스토리 조회&#x20;

```
cat (Get-PSReadlineOption).HistorySavePath
```

다음은 존재하는지, 접근이 가능한지, 파일 안에 크리덴셜 정보가 있는지 확인해야 할 주요 파일입니다. 목록에 있는 파일 이름을 와일드카드 그대로 사용해 탐색합니다. 탐색 이후에는 "passw" 혹은 확인한 로컬 유저 이름 등을 필터에 넣고 Select-String으로 찾습니다.

1. web.config
2. Groups.xml
3. app.config
4. settings.xml
5. initconfig.xml
6. config.json
7. setting.json
8. identity.xml
9. task.xml
