• jQuery火箭图标返回顶部代码


    0x01 漏洞简介

    该漏洞为 Java反序列化错误类型,存在于 Jboss 的 HttpInvoker 组件中的 ReadOnlyAccessFilter过滤器中。该过滤器在没有进行任何安全检查的情况下尝试将来自客户端的数据流进行反序列化,从而导致了攻击者可以在服务器上执行任意代码。

    0x02 漏洞版本

    漏洞影响5.x和6.x版本的JBOSSAS。

    0x03 漏洞原理

    JBOSS Application Server是一个基于J2EE的开放源代码的应用服务器。 JBoss代码遵循LGPL许可,可以在任何商业应用中免费使用。Java序列化:把Java对象转换为字节序列的过程。Java反序列化:指把字节序列恢复为Java对象的过程。
    Java序列化与反序列化作用:便于保存数据,或者进行数据传输。

    序列化
    FileOutputStream fos = new FileOutputStream(file);
    ObjectOutputStream oos = new ObjectOutputStream(fos);
    oos.writeObject(st);
    
    反序列化
    FileInputStream fis = new FileInputStream(file);
    ObjectInputStream ois = new ObjectInputStream(fis);
    Student st1 = (Student) ois.readObject();

    漏洞出现在 Jboss 的 HttpInvoker组件中的 ReadOnlyAccessFilter 过滤器中,源码在jbossserveralldeployhttpha-invoker.sarinvoker.warWEB-INFclassesorgjbossinvocationhttpservlet目录下的ReadOnlyAccessFilter.class文件中,其中doFilter函数代码如下:

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException
      {
        HttpServletRequest httpRequest = (HttpServletRequest)request;
        Principal user = httpRequest.getUserPrincipal();
        if ((user == null) && (this.readOnlyContext != null))
        {
          ServletInputStream sis = request.getInputStream();
          ObjectInputStream ois = new ObjectInputStream(sis);
          MarshalledInvocation mi = null;
          try
          {
            mi = (MarshalledInvocation)ois.readObject();  //漏洞点
          }
          catch (ClassNotFoundException e)
          {
            throw new ServletException("Failed to read MarshalledInvocation", e);
          }
          request.setAttribute("MarshalledInvocation", mi);
    
      mi.setMethodMap(this.namingMethodMap);
      Method m = mi.getMethod();
      if (m != null) {
        validateAccess(m, mi);
      }
    }
    chain.doFilter(request, response);
    
      }
    

    直接从http中获取数据,在没有进行检查或者过滤的情况下,尝试调用readobject()方法对数据流进行反序列操作,因此产生了Java反序列化漏洞。

    0x04 漏洞复现

    1.进入漏洞页面http://your-ip/invoker/readonly。http响应码500(内部服务器错误——服务器端的CGI、ASP、JSP等程序发生错误),分析猜想,此处服务器将用户提交的POST内容进行了Java反序列化。

     我们使用bash来反弹shell,但由于Runtime.getRuntime().exec()中不能使用管道符等bash需要的方法,我们需要用进行一次编码

     工具验证(简单粗暴,不优雅。)
    https://github.com/yunxu1/jboss-_CVE-2017-12149

    将刚刚编码后的内容写进去,就可以反弹到Shell了

     

  • 相关阅读:
    谈谈-开源数据库LitePal
    谈谈-Android-PickerView系列之封装(三)
    谈谈-Android-PickerView系列之源码解析(二)
    谈谈-Android-PickerView系列之介绍与使用(一)
    谈谈-ConstraintLayout完全解析
    问题解决-Failed to resolve: com.android.support.constraint:constraint-layout:1.0.0-alpha7
    谈谈-BaseAdapter的封装
    谈谈-使用SparseArray和ArrayMap代替HashMap
    Spring 集成Redis Cluster模式
    Redis三种集群模式-Cluster集群模式
  • 原文地址:https://www.cnblogs.com/kuaile1314/p/12060366.html
Copyright © 2020-2023  润新知