@
@
@ _ @2021-12-04 05:29:47
PHP
@ _ @, 2021-12-04 05:29:47

XSS bypassing sprintf (Assignment from CTF, no bullshit)?

DISCLAIMER: Quest from CTF. There is no bullshit or malicious intent here.
There is a line of PHP code with the following content

echo sprintf('<form action="%s" method="post">', $_SERVER['PHP_SELF']).PHP_EOL;

How can I bypass sprintf and do XSS injection?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
@
@ _ @, 2021-12-04
@DaniilOLD

Just append to the URL Man, sprintf stupidly inserts the value into the string. It doesn't escape in any way. It would be possible to make simply concatenation. Nothing would have changed.
/"><script>alert(1);</script>

I
index0h, 2021-12-04
@index0h

Won't protect

A
Anton Shamanov, 2021-12-04
@SilenceOfWinter

sprintf - a function for formatting strings, what does data filtering have to do with it? it can be omitted altogether.

echo "<form action=\"$_SERVER['PHP_SELF']\" method=\"post\">";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question