T1027 Obfuscated Files or Information
Adversaries may attempt to make an executable or file difficult to discover or analyze by encrypting, encoding, or otherwise obfuscating its contents on the system or in transit. MITRE ATT&CK
2 programs on CmdID 40 Sigma rules T1027 on attack.mitre.org
Its sub-techniques
Programs for it
Sigma rules tagged with it
Command lines CmdID reads as it
Encode a file in hexadecimal on the page for certutil.exe
certutil -encodehex path\to\input_file path\to\output_fileIdentifyEncode a file to Base64 on the page for certutil.exe
certutil -encode path\to\input_file path\to\output_fileIdentifyAdd a computer to a domain using predefined computer credentials on the page for Add-Computer
$newADComputerSplat = @{
Name = "Server02"
AccountPassword = (ConvertTo-SecureString -String 'TempJoinPA$$' -AsPlainText -Force)
}
New-ADComputer @newADComputerSplat
# Then this command is run from Server02 which is not yet domain-joined:
$joinCred = New-Object pscredential -ArgumentList ([pscustomobject]@{
UserName = $null
Password = (ConvertTo-SecureString -String 'TempJoinPA$$' -AsPlainText -Force)[0]
})
$addComputerSplat = @{
DomainName = "Domain03"
Options = 'UnsecuredJoin', 'PasswordPass'
Credential = $joinCred
}
Add-Computer @addComputerSplatIdentifyConvert a secure string to an encrypted string on the page for ConvertTo-SecureString
PS C:> $Secure = Read-Host -AsSecureString
PS C:> $Secure
System.Security.SecureString
PS C:> $Encrypted = ConvertFrom-SecureString -SecureString $Secure
PS C:> $Encrypted
01000000d08c9ddf0115d1118c7a00c04fc297eb010000001a114d45b8dd3f4aa11ad7c0abdae98000000000
02000000000003660000a8000000100000005df63cea84bfb7d70bd6842e7efa79820000000004800000a000
000010000000f10cd0f4a99a8d5814d94e0687d7430b100000008bf11f1960158405b2779613e9352c6d1400
0000e6b7bf46a9d485ff211b9b2a2df3bd6eb67aae41
PS C:> $Secure2 = ConvertTo-SecureString -String $Encrypted
PS C:> $Secure2
System.Security.SecureStringIdentifyCreate a secure string from an encrypted string in a file on the page for ConvertTo-SecureString
$Secure = Read-Host -AsSecureString
$Encrypted = ConvertFrom-SecureString -SecureString $Secure -Key (1..16)
$Encrypted | Set-Content Encrypted.txt
$Secure2 = Get-Content Encrypted.txt | ConvertTo-SecureString -Key (1..16)IdentifyConvert a plain text string to a secure string on the page for ConvertTo-SecureString
$Secure_String_Pwd = ConvertTo-SecureString "P@ssW0rD!" -AsPlainText -ForceIdentifySet foreground and background colors on the page for Set-PSReadLineOption
Set-PSReadLineOption -Colors @{ "Comment"="$([char]0x1b)[32;47m" }IdentifySet color values for multiple types on the page for Set-PSReadLineOption
Set-PSReadLineOption -Colors @{
# Use a ConsoleColor enum
"Error" = [ConsoleColor]::DarkRed
# 24 bit color escape sequence
"String" = "$([char]0x1b)[38;5;100m"
# RGB value
"Command" = "#8181f7"
}IdentifyUse ViModeChangeHandler to display Vi mode changes on the page for Set-PSReadLineOption
function OnViModeChange {
if ($args[0] -eq 'Command') {
# Set the cursor to a blinking block.
Write-Host -NoNewline "$([char]0x1b)[1 q"
} else {
# Set the cursor to a blinking line.
Write-Host -NoNewline "$([char]0x1b)[5 q"
}
}
Set-PSReadLineOption -ViModeIndicator Script -ViModeChangeHandler $Function:OnViModeChangeIdentifyAdd items to a property value on the page for Update-List
class Cards {
[System.Collections.Generic.List[string]]$Cards
[string]$Name
Cards([string]$_name) {
$this.Name = $_name
$this.Cards = [System.Collections.Generic.List[string]]::new()
}
NewDeck() {
$_suits = [char]0x2663,[char]0x2666,[char]0x2665,[char]0x2660
$_values = 'A',2,3,4,5,6,7,8,9,10,'J','Q','K'
$_deck = foreach ($s in $_suits){ foreach ($v in $_values){ "$v$s"} }
$this | Update-List -Property Cards -Add $_deck | Out-Null
}
Show() {
Write-Host
Write-Host $this.Name ": " $this.Cards[0..12]
if ($this.Cards.Count -gt 13) {
Write-Host (' ' * ($this.Name.Length+3)) $this.Cards[13..25]
}
if ($this.Cards.Count -gt 26) {
Write-Host (' ' * ($this.Name.Length+3)) $this.Cards[26..38]
}
if ($this.Cards.Count -gt 39) {
Write-Host (' ' * ($this.Name.Length+3)) $this.Cards[39..51]
}
}
Shuffle() { $this.Cards = Get-Random -InputObject $this.Cards -Count 52 }
Sort() { $this.Cards.Sort() }
}IdentifyAn example is here when CmdID’s reading of it names T1027: a Sigma rule it trips is tagged with it, or its abuse is documented as it.