提问人:Geek 提问时间:9/27/2023 更新时间:9/27/2023 访问量:38
重新创建 SQL 注入示例时无法注入查询
Unable to inject a query while recreating SQL Injection example
问:
我正在尝试重新创建一个 SQL 注入示例,但在查询中注入有效负载后没有得到任何输出。
代码的相关部分
var express = require('express');
var path = require('path');
var mysql = require('mysql');
var bodyParser = require('body-parser');
var app = express();
app.use(express.urlencoded({ extended: true }));
var connection = mysql.createConnection({
host : 'localhost',
user : 'root',
password : 'password',
database : 'node_db'
});
app.post('/search_guest', (req, res) => {
const room_no = req.body.room_no;
const sql = 'SELECT * FROM guest WHERE room_no = ' + room_no ;
connection.query(sql, (err, results) => {
if (err) {
console.error('Error executing query:', err);
return;
}
res.send(results);
我尝试了多个有效载荷,包括 UNION SELECT、ORDER BY 等,但似乎没有任何效果。
我收到的错误:
code: 'ER_PARSE_ERROR',
errno: 1064,
sqlMessage: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''' at line 1",
sqlState: '42000',
index: 0,
sql: "SELECT * FROM guest WHERE room_no = 103'UNION SELECT * FROM sensitive_table"
我预计代码会受到攻击,并通过从其他表抛出数据来响应 SQL 注入攻击,否则这些数据不会直接传递给客户端。
答: 暂无答案
评论