api
security_error
ai_generated
true
400 错误请求:查询参数包含被屏蔽的 SQL 关键字
400 Bad Request: Query parameter contains blocked SQL keywords
ID: api/rest-query-parameter-sql-injection-blocked
88%修复率
86%置信度
1证据数
2024-01-08首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| AWS WAF 2024 | active | — | — | — |
| Cloudflare WAF 2023 | active | — | — | — |
| Kong Gateway 3.5 | active | — | — | — |
| nginx ModSecurity 3.0 | active | — | — | — |
根因分析
API 网关或 WAF(Web 应用防火墙)将查询参数值标记为包含 SQL 注入模式(例如 SELECT、DROP、UNION)并拒绝了该请求。
English
API gateway or WAF (Web Application Firewall) flagged a query parameter value as containing SQL injection patterns (e.g., SELECT, DROP, UNION) and rejected the request.
官方文档
https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-statement-type-whitelist.html解决方案
-
对于接受可能包含 SQL 关键字的用户输入的搜索/过滤端点,使用 POST 请求加 JSON 体代替 GET 加查询参数。这将负载移出 URL,WAF 规则通常对请求体不那么激进。
-
如果某个参数(如 'search' 或 'query')已知会接受可能包含类似 SQL 模式的任意文本作为合法数据(例如代码搜索工具),则为该特定参数名称添加 WAF 例外规则。
无效尝试
常见但无效的做法:
-
85% 失败
Modern WAFs decode URL-encoded payloads before inspection; double encoding may work temporarily but is often patched quickly and violates API standards.
-
95% 失败
This removes critical security protection, making the API vulnerable to actual SQL injection attacks; not recommended for production.