Files
atomic-red-team/atomics/T1139/T1139.md
T
2018-05-23 23:09:31 +00:00

38 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# T1139 - Bash History
## [Description from ATT&CK](https://attack.mitre.org/wiki/Technique/T1139)
<blockquote>Bash keeps track of the commands users type on the command-line with the "history" utility. Once a user logs out, the history is flushed to the users <code>.bash_history</code> file. For each user, this file resides at the same location: <code>~/.bash_history</code>. Typically, this file keeps track of the users last 500 commands. Users often type usernames and passwords on the command-line as parameters to programs, which then get saved to this file when they log out. Attackers can abuse this by looking through the file for potential credentials. (Citation: External to DA, the OS X Way)
Detection: Monitoring when the user's <code>.bash_history</code> is read can help alert to suspicious activity. While users do typically rely on their history of commands, they often access this history through other utilities like "history" instead of commands like <code>cat ~/.bash_history</code>.
Platforms: Linux, macOS
Data Sources: File monitoring, Process monitoring, Process command-line parameters
Permissions Required: User</blockquote>
## Atomic Tests
- [Atomic Test #1 - xxxx](#atomic-test-1---xxxx)
<br/>
## Atomic Test #1 - xxxx
xxxx
**Supported Platforms:** Linux, macOS
#### Inputs
| Name | Description | Type | Default Value |
|------|-------------|------|---------------|
| bash_history_filename | Path of the bash history file to capture | Path | ~/.bash_history|
| bash_history_grep_args | grep arguments that filter out specific commands we want to capture | Path | -e '-p ' -e 'pass' -e 'ssh'|
| output_file | Path where captured results will be placed | Path | ~/loot.txt|
#### Run it with `sh`!
```
cat #{bash_history_filename} | grep #{bash_history_grep_args} > #{output_file}
```
<br/>