Note that there are some explanatory texts on larger screens.

plurals
  1. POXSS PHP Input/Output
    primarykey
    data
    text
    <p>Hi Question about XSS and PHP......</p> <p>I am building a PHP Application all input is going to the database via client then server side validation, sanitization using filtervar.....encrypted passwords stored in the database, if I a type in scripttag -- whatever -- script tag it gets stored in the database as just that, and it can't do any harm there.</p> <p>Is XSS only a threat when input is being directly outputted and and the only time to use htmlentities is at the point of outputting inputted data from the user.</p> <p>My App doesn't do this, but is there a way for a would be attacker to inject some malicious code and cause it to be outputted, even though my programming logic doesn't allow for this.</p> <p>I want to have all bases covered.........</p> <p>Look forward to your answers......... Yes I'm using PDO prepared statements, bindParam, execute to prevent SQL Injection, and to store the data safely in the database, I'm also using : </p> <pre><code> if(filter_var($_POST['firstname'], FILTER_SANITIZE_STRING)){ $clean['firstname'] = $_POST['firstname']; }; </code></pre> <p>For the Sanitization could that be improved on........... </p> <p>I just fixed the code, the if statement was preventing the filter var from sanitizing the script tags see below : </p> <pre><code>$clean = array(); $clean['firstname'] = (filter_var($_POST['firstname'], FILTER_SANITIZE_STRING)); $clean['lastname'] = (filter_var($_POST['lastname'], FILTER_SANITIZE_STRING)); $clean['username'] = (filter_var($_POST['username'], FILTER_SANITIZE_STRING)); </code></pre> <p>Now the script tags are no longer in the database......... </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload