I - Je travaille sur la refonte d'un site fait en mySQLi et j'ai d'abord, décidé de tester les failles de sécurité en injectant du javaScript <script>alert("Test XSS")</script. comme ceci:
Code : Tout sélectionner
http://localhost/app/index.php?page=home<script>alert("Test XSS")</script>Alors que mon Fichier index.php contient le bout de Code qui appelle en get le Paramètre page:
Code : Tout sélectionner
<?php
$page = isset($_GET['page']) ? $_GET['page'] : 'home';
if(!file_exists($page.".php")){
include '404.html';
}else{
include $page.'.php';
}
?>II- TOUJOURS EN PHASE DE TEST DE LA MÊME APPLICATION PHP, j'ai injecté un apostrophe (') à la fin du lien http://localhost/stamp/index.php?page=edit_staff&id=2' c'est à dire juste après le id=2, j'ai ajouté un petit signe ' histoire de voire si ça pourrait me retourné une erreur SQL:
ET VOICI L'ERREUR QUE ÇA ME RETOURNE:
Code : Tout sélectionner
Fatal error: Uncaught Error: Call to a member function fetch_array() on boolean in C:\laragon\www\stamp\edit_staff.php:3 Stack trace: #0 C:\laragon\www\stamp\index.php(54): include() #1 {main} thrown in C:\laragon\www\stamp\edit_staff.php on line 3Code : Tout sélectionner
<?php
include 'db_connect.php';
$qry = $conn->query("SELECT * FROM users where id = ".$_GET['id'])->fetch_array();
foreach($qry as $k => $v){
$$k = $v;
}
include 'new_user.php';
?>
AIDEZ-MOI S'IL VOUS PLAÎT.