From ce43569dcf3246bba4cf376c8da848dbd98afa47 Mon Sep 17 00:00:00 2001 From: tlor89 <60741301+tlor89@users.noreply.github.com> Date: Fri, 28 Feb 2020 12:03:31 -0600 Subject: [PATCH] T1096-T1138_CleanupErrors (#842) Co-authored-by: Carrie Roberts --- atomics/T1096/T1096.yaml | 13 +++++-------- atomics/T1102/T1102.yaml | 3 +-- atomics/T1112/T1112.yaml | 6 +++--- atomics/T1119/T1119.yaml | 14 +++++++------- atomics/T1121/T1121.yaml | 4 ++-- atomics/T1136/T1136.yaml | 4 ++-- atomics/T1138/T1138.yaml | 8 ++++---- 7 files changed, 24 insertions(+), 28 deletions(-) diff --git a/atomics/T1096/T1096.yaml b/atomics/T1096/T1096.yaml index 91382cae..749c335c 100644 --- a/atomics/T1096/T1096.yaml +++ b/atomics/T1096/T1096.yaml @@ -54,19 +54,16 @@ atomic_tests: ads_name: description: Name of ADS type: string - default: ADSName + default: desktop.ini executor: name: powershell elevation_required: false prereq_command: | - if (!(Test-Path "#{ads_file_path}")) - { - $FileCreated = New-Item -Path "#{ads_file_path}" -Type "file" -Force - 0 - } - else {0} command: | + if (!(Test-Path C:\Users\Public\Libraries\yanki -PathType Container)) { + New-Item -ItemType Directory -Force -Path C:\Users\Public\Libraries\yanki + } Start-Process -FilePath "$env:comspec" -ArgumentList "/c,type,#{payload_path},>,`"#{ads_file_path}:#{ads_name}`"" cleanup_command: | - Remove-Item -Path "#{ads_file_path}" -Stream "#{ads_name}" \ No newline at end of file + Remove-Item "#{ads_file_path}" -Force -ErrorAction Ignore \ No newline at end of file diff --git a/atomics/T1102/T1102.yaml b/atomics/T1102/T1102.yaml index ead75677..9ca998e0 100644 --- a/atomics/T1102/T1102.yaml +++ b/atomics/T1102/T1102.yaml @@ -31,5 +31,4 @@ atomic_tests: $wc = New-Object System.Net.WebClient $T1102 = $wc.DownloadString("https://www.aol.com/") cleanup_command: | - Clear-Variable T1102 - + Clear-Variable T1102 >$null 2>&1 \ No newline at end of file diff --git a/atomics/T1112/T1112.yaml b/atomics/T1112/T1112.yaml index 0cd7b7a6..8fc126b6 100644 --- a/atomics/T1112/T1112.yaml +++ b/atomics/T1112/T1112.yaml @@ -133,7 +133,7 @@ atomic_tests: $EncodedCommand Set-ItemProperty -Force -Path #{registry_key_storage} -Name #{registry_entry_storage} -Value $EncodedCommand cleanup_command: | - Remove-ItemProperty -Force -Path -Path #{registry_key_storage} -Name #{registry_entry_storage} + Remove-ItemProperty -Force -Path #{registry_key_storage} -Name #{registry_entry_storage} -ErrorAction Ignore - name: Add domain to Trusted sites Zone description: | @@ -155,7 +155,7 @@ atomic_tests: cleanup_command: | $key = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\bad-domain.com\" - Remove-item $key -Recurse + Remove-item $key -Recurse -ErrorAction Ignore - name: Javascript in registry description: | @@ -168,4 +168,4 @@ atomic_tests: command: | New-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name T1112 -Value "