Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.22 KB | None | 0 0
  1. ###############################################################################
  2. # OpenVAS Vulnerability Test
  3. # $Id$
  4. #
  5. # Graylog Default HTTP Login
  6. #
  7. # Authors:
  8. # Tameem Eissa <tameem.eissa@greenbone.net>
  9. #
  10. # Copyright:
  11. # Copyright (c) 2016 Greenbone Networks GmbH
  12. #
  13. # This program is free software; you can redistribute it and/or
  14. # modify it under the terms of the GNU General Public License
  15. # as published by the Free Software Foundation; either version 2
  16. # of the License, or (at your option) any later version.
  17. #
  18. # This program is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License
  24. # along with this program; if not, write to the Free Software
  25. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  26. ###############################################################################
  27.  
  28.  
  29.  
  30. if (description)
  31. {
  32. script_oid("1.3.6.1.4.1.25623.1.0.105756");
  33. script_version ("$Revision: 3477 $");
  34. script_tag(name:"cvss_base", value:"7.5");
  35. script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:P/I:P/A:P");
  36. script_name("Loxone Smart Home Default Admin HTTP Login");
  37.  
  38. script_tag(name: "impact" , value:"Attackers can exploit this issue to obtain sensitive information that may lead to further attacks.");
  39. script_tag(name: "vuldetect" , value:"Try to login with default credentials admin:admin");
  40. script_tag(name: "solution" , value:"Change the password");
  41. script_tag(name: "summary" , value:"The remote Loxone installation has default credentials set.");
  42. script_tag(name:"solution_type", value: "Workaround");
  43.  
  44. script_tag(name:"qod_type", value:"remote_vul");
  45.  
  46. script_tag(name:"last_modification", value:"$Date$");
  47. script_tag(name:"creation_date", value:"2016-08-31 13:18:59 +0200 (Wed, 31 Aug 2016)");
  48. script_summary("Try to login with admin:admin");
  49. script_category(ACT_ATTACK);
  50. script_family("Web application abuses");
  51. script_copyright("This script is Copyright (C) 2016 Greenbone Networks GmbH");
  52. script_dependencies("http_version.nasl");
  53. script_require_ports("Services/www", 12900);
  54. script_exclude_keys("Settings/disable_cgi_scanning");
  55.  
  56. exit(0);
  57. }
  58.  
  59. include("http_func.inc");
  60. include("http_keepalive.inc");
  61. include("host_details.inc");
  62. include("misc_func.inc");
  63.  
  64.  
  65. url = "";
  66. Banner = "";
  67. http_port = "";
  68.  
  69. ## Get HTTP Port
  70. http_port = get_http_port(default:80);
  71.  
  72. ## Confirm the application before trying exploit
  73. #Banner = get_http_banner(port: http_port);
  74. #display("Banner = ", Banner, "\");
  75. #if(!Banner || "Server: Loxone" >!< Banner){
  76. # exit(0);
  77. #}
  78.  
  79. user = "admin";
  80. pass = "admin";
  81. host = get_host_name();
  82.  
  83. rand = rand_str( length:17, charset: "0123456789");
  84.  
  85. #data = "admin&password= password";
  86. #req = http_post_req( port:port,
  87. # url:'/Login.html',
  88. # data:data,
  89. # accept_header:'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  90. # add_headers: make_array("Cookie", cookie + '; loginName=admin',
  91. # "Content-Type", "application/x-www-form-urlencoded") );
  92. req = string("GET /jdev/sys/getkey?0.", rand, " HTTP/1.1\r\n",
  93. "Host: ", host,":",http_port, "\r\n",
  94. "Content-Type: application/x-www-form-urlencoded\r\n",
  95. "Content-Length: ", strlen(data), "\r\n"
  96. );
  97. res = http_keepalive_send_recv( port:http_port, data:req, bodyonly:FALSE );
  98. display ("req = ", req, "\n");
  99. if ( res !~ "HTTP/1\.. 200" || '{"LL": {' >!< res ) exit( 0 );
  100. display ("res = ", res, "\n");
  101. if ( res =~ '"LL": [{] "control": "dev/sys/getkey", "value": "([A-F0-9]+)", "Code": "200"}}') display ("success\n");
  102.  
  103. json_key = eregmatch (pattern: '"LL": [{] "control": "dev/sys/getkey", "value": "([A-F0-9]+)", "Code": "200"}}', string: res, icase:TRUE);
  104. display ("json_key = ", json_key, "\n");
  105. key = json_key[1];
  106. display ("key = ", key, "\n");
  107. username = "admin";
  108. password = "admin";
  109. protocol = HMAC_SHA1(data:username+":"+password, key: key);
  110. display ("protocol = ", hexstr(protocol), "\n");
  111.  
  112. reqws = string("GET /ws HTTP/1.1", "\r\n",
  113. "Host: ", host, "\r\n",
  114. "User-Agent: " , OPENVAS_HTTP_USER_AGENT , "\r\n",
  115. "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n",
  116. "Accept-Language: en-US,en;q=0.5\r\n",
  117. "Accept-Encoding: gzip, deflate\r\n",
  118. "Sec-WebSocket-Version: 13\r\n",
  119. "Origin: http://", host, "\r\n",
  120. "Sec-WebSocket-Protocol: ", hexstr(protocol), "\r\n",
  121. "Sec-WebSocket-Extensions: permessage-deflate\r\n",
  122. # "Sec-WebSocket-Key: kfMAoT7HICtP3U0v1AHkuw==\r\n",
  123. "Connection: keep-alive, Upgrade\r\n",
  124. "Pragma: no-cache\r\n",
  125. "Cache-Control: no-cache\r\n",
  126. "Upgrade: websocket\r\n");
  127. display ("reqw s= ", reqws, "\n");
  128. res = http_keepalive_send_recv( port:http_port, data:reqws, bodyonly:FALSE );
  129. display ("reqws = ", reqws, "\n");
  130.  
  131.  
  132. exit( 99 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement