forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new embedded pe in data section parse (Velocidex#1943)
Co-authored-by: Mike Cohen <mike@velocidex.com>
- Loading branch information
Showing
10 changed files
with
262 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
Queries: | ||
#prefix: srcDir + "/artifacts/testdata/files/CSSectionPE.bin" | ||
# tests for file parsing | ||
- SELECT Rule, relpath(path=FullPath, base=srcDir, sep="/") as FullPath,Hash,Offset,Xor,DecodedConfig | ||
- SELECT Rule, relpath(path=FullPath, base=srcDir, sep="/") as FullPath,Hash,Xor,DecodedConfig | ||
FROM Artifact.Windows.Carving.CobaltStrike(TargetFileGlob=srcDir + "/artifacts/testdata/files/CSDump.bin") | ||
|
||
# Test for data stream parsing, DecodedData output and bruteforce xor | ||
- LET Encoded = SELECT Data FROM read_file(filenames=srcDir + "/artifacts/testdata/files/CSDump.bin") | ||
- SELECT Rule,Hash,Offset,Xor,DecodedConfig,DecodedData | ||
- SELECT Rule,Hash,Xor,DecodedConfig,DecodedData | ||
FROM Artifact.Windows.Carving.CobaltStrike(TargetBytes=Encoded.Data[0],BruteXor="T", IncludeDecodedData="Y") | ||
|
||
# tests shellcode parsing | ||
- SELECT Rule, relpath(path=FullPath, base=srcDir, sep="/") as FullPath,Hash,Offset,Xor,DecodedConfig | ||
- SELECT Rule, relpath(path=FullPath, base=srcDir, sep="/") as FullPath,Hash,Xor,DecodedConfig | ||
FROM Artifact.Windows.Carving.CobaltStrike(TargetFileGlob=srcDir + "/artifacts/testdata/files/CSShellcode.bin") | ||
# tests sleepfunctino parsing | ||
- SELECT Rule, relpath(path=FullPath, base=srcDir, sep="/") as FullPath,Hash,Offset,Xor,DecodedConfig | ||
|
||
# tests sleepfunction parsing | ||
- SELECT Rule, relpath(path=FullPath, base=srcDir, sep="/") as FullPath,Hash,Xor,DecodedConfig | ||
FROM Artifact.Windows.Carving.CobaltStrike(TargetFileGlob=srcDir + "/artifacts/testdata/files/CSx86sleep.bin") |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Parameters: | ||
RemappingTemplate: | | ||
remappings: | ||
- type: mount | ||
from: | ||
accessor: zip | ||
path_type: linux | ||
prefix: | | ||
{ | ||
"DelegateAccessor": "scope", | ||
"DelegatePath": "Content", | ||
"Path": "/" | ||
} | ||
on: | ||
accessor: "auto" | ||
prefix: "/" | ||
path_type: "windows" | ||
Queries: | ||
# tests embedded pe in data section parsing | ||
- LET Content <= xor(key='infected',string=read_file(filename=srcDir+"/artifacts/testdata/files/CSSectionPE.zip.xor")) | ||
- LET _ <= remap(config=RemappingTemplate, copy=["zip", "data", "scope"], clear=TRUE) | ||
|
||
# Scan all the files in the container. | ||
- SELECT Rule,FullPath,Hash,Xor,DecodedConfig | ||
FROM Artifact.Windows.Carving.CobaltStrike(TargetFileGlob="/**") | ||
|
||
# Use byte scanning of the raw file. | ||
- SELECT Rule,Hash,Xor,DecodedConfig | ||
FROM Artifact.Windows.Carving.CobaltStrike(TargetBytes=read_file(filename="C:/CSSectionPE.bin")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
LET Content <= xor(key='infected',string=read_file(filename=srcDir+"/artifacts/testdata/files/CSSectionPE.zip.xor"))[]LET _ <= remap(config=RemappingTemplate, copy=["zip", "data", "scope"], clear=TRUE)[]SELECT Rule,FullPath,Hash,Xor,DecodedConfig FROM Artifact.Windows.Carving.CobaltStrike(TargetFileGlob="/**")[ | ||
{ | ||
"Rule": "Embedded data section: cobalt_strike_beacon", | ||
"FullPath": "C:\\CSSectionPE.bin", | ||
"Hash": { | ||
"MD5": "6e1ee07d95a9b169567856313ff324eb", | ||
"SHA1": "3727f7592d7f4d00285800e4d855431801dc4ceb", | ||
"SHA256": "fb4fc487ca159700b0af9fb54f6010c78709c9cc2b95c7cde017f49d7bb833c8" | ||
}, | ||
"Xor": "0x69", | ||
"DecodedConfig": { | ||
"BeaconType": "windows-beacon_smb-bind_pipe", | ||
"Port": 4444, | ||
"Sleeptime": 10000, | ||
"Maxgetsize": 1048576, | ||
"Jitter": 0, | ||
"MaxDns": 0, | ||
"PublicKey": "30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 aa ed 4a fd 72 4f 7d ae c2 10 f6 99 ba db 4e 4d d1 3f 16 05 74 09 33 5d 10 b5 03 fc 0b 87 59 a9 15 3f 88 4f ec f5 13 e6 b8 32 30 f9 54 ae 12 98 6d b8 a3 ff c8 fa 1e 10 7e e7 12 e1 ee da f4 63 36 db 4b d4 3c 64 1a 80 c6 c6 53 1a f4 de eb c0 38 c1 db 59 5b 5b 4a de 5d 63 09 39 29 5c 61 8c c0 43 50 94 dd 31 2f 91 1a e1 e4 7c c2 ae 0c 3a 50 15 3f 4c d4 24 71 d6 6e 06 79 2c e1 07 8c cf 02 03 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", | ||
"C2Server": "", | ||
"UserAgent": "", | ||
"PostURI": "", | ||
"MalleableC2Instructions": "", | ||
"HttpGetHeader": "", | ||
"HttpPostHeader": "", | ||
"SpawnTo": "", | ||
"Pipename": "\\\\%s\\pipe\\fhsvc-%x", | ||
"KillDateYear": 0, | ||
"KillDateMonth": 0, | ||
"KillDateDay": 0, | ||
"DNSIdle": "0.0.0.0", | ||
"DNSSleep": 0, | ||
"SSH_1": "", | ||
"SSH_2": "", | ||
"SSH_3": "", | ||
"SSH_4": "", | ||
"SSH_5": "", | ||
"GetVerb": "", | ||
"PostVerb": "", | ||
"HttpPostChunk": 0, | ||
"SpawnTox86": "%windir%\\syswow64\\rundll32.exe", | ||
"SpawnTox64": "%windir%\\sysnative\\rundll32.exe", | ||
"CryptoScheme": 0, | ||
"Proxy": "", | ||
"ProxyUsername": "", | ||
"ProxyPassword": "", | ||
"ProxyType": "0x0", | ||
"Deprecated": 3, | ||
"LicenseId": 331083543, | ||
"bStageCleanup": 0, | ||
"bCFGCaution": 0, | ||
"KillDate": 0, | ||
"TextSectionEnd": 0, | ||
"ObfuscateSectionsInfo": "", | ||
"ProcessInjectStartRWX": "0x0", | ||
"ProcessInjectUseRWX": "0x0", | ||
"ProcessInjectMinAlloc": 0, | ||
"ProcessInjectTransformx86": "", | ||
"ProcessInjectTransformx64": "", | ||
"UsesCookies": 0, | ||
"ProcessInjectExecute": "", | ||
"ProcessInjectAllocationMethod": 0, | ||
"ProcessInjectStub": "", | ||
"HostHeader": "" | ||
} | ||
} | ||
]SELECT Rule,Hash,Xor,DecodedConfig FROM Artifact.Windows.Carving.CobaltStrike(TargetBytes=read_file(filename="C:/CSSectionPE.bin"))[ | ||
{ | ||
"Rule": "Embedded data section: cobalt_strike_beacon", | ||
"Hash": { | ||
"MD5": "6e1ee07d95a9b169567856313ff324eb", | ||
"SHA1": "3727f7592d7f4d00285800e4d855431801dc4ceb", | ||
"SHA256": "fb4fc487ca159700b0af9fb54f6010c78709c9cc2b95c7cde017f49d7bb833c8" | ||
}, | ||
"Xor": "0x69", | ||
"DecodedConfig": { | ||
"BeaconType": "windows-beacon_smb-bind_pipe", | ||
"Port": 4444, | ||
"Sleeptime": 10000, | ||
"Maxgetsize": 1048576, | ||
"Jitter": 0, | ||
"MaxDns": 0, | ||
"PublicKey": "30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 81 8d 00 30 81 89 02 81 81 00 aa ed 4a fd 72 4f 7d ae c2 10 f6 99 ba db 4e 4d d1 3f 16 05 74 09 33 5d 10 b5 03 fc 0b 87 59 a9 15 3f 88 4f ec f5 13 e6 b8 32 30 f9 54 ae 12 98 6d b8 a3 ff c8 fa 1e 10 7e e7 12 e1 ee da f4 63 36 db 4b d4 3c 64 1a 80 c6 c6 53 1a f4 de eb c0 38 c1 db 59 5b 5b 4a de 5d 63 09 39 29 5c 61 8c c0 43 50 94 dd 31 2f 91 1a e1 e4 7c c2 ae 0c 3a 50 15 3f 4c d4 24 71 d6 6e 06 79 2c e1 07 8c cf 02 03 01 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", | ||
"C2Server": "", | ||
"UserAgent": "", | ||
"PostURI": "", | ||
"MalleableC2Instructions": "", | ||
"HttpGetHeader": "", | ||
"HttpPostHeader": "", | ||
"SpawnTo": "", | ||
"Pipename": "\\\\%s\\pipe\\fhsvc-%x", | ||
"KillDateYear": 0, | ||
"KillDateMonth": 0, | ||
"KillDateDay": 0, | ||
"DNSIdle": "0.0.0.0", | ||
"DNSSleep": 0, | ||
"SSH_1": "", | ||
"SSH_2": "", | ||
"SSH_3": "", | ||
"SSH_4": "", | ||
"SSH_5": "", | ||
"GetVerb": "", | ||
"PostVerb": "", | ||
"HttpPostChunk": 0, | ||
"SpawnTox86": "%windir%\\syswow64\\rundll32.exe", | ||
"SpawnTox64": "%windir%\\sysnative\\rundll32.exe", | ||
"CryptoScheme": 0, | ||
"Proxy": "", | ||
"ProxyUsername": "", | ||
"ProxyPassword": "", | ||
"ProxyType": "0x0", | ||
"Deprecated": 3, | ||
"LicenseId": 331083543, | ||
"bStageCleanup": 0, | ||
"bCFGCaution": 0, | ||
"KillDate": 0, | ||
"TextSectionEnd": 0, | ||
"ObfuscateSectionsInfo": "", | ||
"ProcessInjectStartRWX": "0x0", | ||
"ProcessInjectUseRWX": "0x0", | ||
"ProcessInjectMinAlloc": 0, | ||
"ProcessInjectTransformx86": "", | ||
"ProcessInjectTransformx64": "", | ||
"UsesCookies": 0, | ||
"ProcessInjectExecute": "", | ||
"ProcessInjectAllocationMethod": 0, | ||
"ProcessInjectStub": "", | ||
"HostHeader": "" | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.