BugKu Web WP

变量1

这道题要好好说一下,因为以前不太知道这个套路。

我们来看看源码:

这个代码最重要的两部分:一是 正则匹配,对我们输入的进行检查。  二是  var_dump($$args)  这句代码。

我们可以想到 如果我们的 $args 的值 刚好是 这个php代码中的一个变量名称,那么我们 是不是就可以通过 $$args  将这个变量打印出来了。例如:

那么接下来,我们就该想到,我们的 $args 应该是什么,才能把 flag 打印出来呢? 

我们来了解一下 php 中的一个全局数组变量 GLOBALS

$GLOBALS 是一个关联数组,每一个变量为一个元素,键名对应变量名,值对应变量的内容。$GLOBALS 之所以在全局范围内存在,是因为 $GLOBALS 是一个超全局变量。以下范例显示了超全局变量的用处:

所以我们可以将 $args 的值设为 GLOBALS, 这样我们会将 Php代码中的所有变量全都打印出来。


Web5

提示了JSFuck, 直接看网页源代码,然后发现了一大堆JSFuck的编码,直接解码即可


头等舱

感觉是为了让大家熟悉 burp suite 的用法,直接抓包看响应包头即可。


网站被黑

这道题重点是为了告诉大家在实战中善用扫描器。

不过,我刚开始使用脚本扫描没有扫到这个 shell.php, 后来换了御剑扫描器,就扫到了。

访问 shell.php, 这里应该就很简单了,弱密码可以直接使用 burp suite 爆破解密。


Web4

我们查看源码,里面是 url 加密的。

我将上面的进行url 解密整理之后,得到了如下代码: 所以很简单,我们就得到了password的值。

 


Cookies欺骗

这道题涉及到文件包含的问题,大家可以自己多去了解一下文件包含漏洞。

我们可以发现这里访问的filename 是 一个base64加密的,所以我们对其进行解密,发现他是 keys.txt。 所以我们更改他的值为 index.php, 读取 index.php的内容。读取的第一行如下:

当我们将整个index.php读取完的代码如下:

这个代码逻辑很简单,我们只需要将我们的cookie设置为 margin 就可以读取 keys.php的内容。

那么我们用burp suite 将cookie设置为 margin,将 filename 设置为 keys.php 的base64加密。


成绩单

这道题是一个 sql 注入。

题目正常,没有对我们的注入语句进行过滤,所以我们可以按照正常的注入语句,一步一步爆出flag。

下面是 爆表  爆列名 爆flag 的注入语句:

0'Union select 1, table_name ,3,4 from information_schema.tables where table_schema = 'skctf_flag'#

0' union select 1,column_name,3,4 from information_schema.columns where table_name='fl4g' #


0' union select 1,skctf_flag,3,4 from fl4g #

 


点击一百万次

这道题我们直接查看JS,发现 我们点击的次数需要 > 100000, 刚开始我以为只需要修改本地JS的代码,就准备将 1000000 修改小一点,后来发现不行。是因为 他会将我们的点击次数发送给后台,所以我们这里需要修改的是我们的 点击次数。

那么我们直接使用 hackbar 工具,将我们的 clicks 变量修改为 1000000 发送给 服务器。

 


请输入密码

这道题,直接使用 burp suite 进行爆破


flag在index里

看到如下的url 形式,我们就想到了和上面类似的漏洞 本地文件包含漏洞,所以我们直接读取 index.php的内容,为了将

index.php的内容一次读取完,我们将其进行 Base64 编码,然后在进行解密。

解密的代码如下:


Never give up

直接查看源码:

发现了一个网址,我们访问,但是这里发现访问这个网址会被重定向到另一个网页,所以我们直接查看这个网页的源码:

我们发现了许多加密的密文,这段密文首先需要先用 url 解密,再用 base64 解密,解密之后的代码如下:

";if(!$_GET['id'])
{
	header('Location: hello.php?id=1');
	exit();
}
$id=$_GET['id'];
$a=$_GET['a'];
$b=$_GET['b'];
if(stripos($a,'.'))
{
	echo 'no no no no no no no';
	return ;
}
$data = @file_get_contents($a,'r');
if($data=="bugku is a nice plateform!" and $id==0 and strlen($b)>5 and eregi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4)
{
	require("f4l2a3g.txt");
}
else
{
	print "never never never give up !!!";
}
?>

这里就是一个代码审计的问题了:

首先 $id == 0, 这个可以通过 PHP 的弱比较,直接绕过。

然后是  $b 需要长度大于 5, 同时 eregi("111".substr($b,0,1),"1114"),也就是 111 和 $b 的第一个字符连接 需要和 1114匹配,还有  substr($b,0,1)!=4   $b的 第一个字符不能是4。 那么这个如何绕过呢?  我们想到了  0x00 截断, 也就是 substr($b,0,1) 函数在读取$b中的字符时,如果中途遇见了 0x00 也就是空格,那么他就会停止读取,直接返回。  如果我们这里将  $b 的第一个字符设置为 0x00,那么再读取到 $b 的第一个字符时,碰见空格, substr就会返回。 同时 111 与 1114 匹配。  $b的第一个字符为空格不为4。  所以我们就成功进行了 绕过。

最后  $data = @file_get_contents($a,'r');   $data=="bugku is a nice plateform!"   。也就是 从 $a 文件中读取出来的内容要为 这个字符串。

看到 file_get_contents() 函数,我们就想到了 文件写漏洞, 我们可以使用 php://input, 将我们的 post 的内容写入  $a 这个文件。 关于这个漏洞其实是和 文件包含漏洞一体的,大家可以自行研究。

那么我们最终的输入如下:

此处,注意 $b 的第一个字符 如果输入  0x00, 那么在上传时也会被截断,所以我们将其修改为 url 编码 的 %00。


过狗一句话

这道题我们根据提示,其实可以发现是  assert() 命令执行漏洞。 那么我么可以 将  $s 的值设为我们想要执行的命令。

那么我们可以输入查看当前路径文件 命令,这个命令我找了很久也找了很多个,最终发现这个可以成功,其他的都没有尝试成功, 找到了有一个 flag.txt。 直接进去查看即可。


前女友

看到这题,题目感觉像是 出题人的真实情感经历,哈哈!

代码审计: md5 这个都很熟悉了, 主要是有两种绕过方法: 一是我们传入数组对象,因为数组对象在进行md5 加密时,都会返回 false, 所以因为 弱比较我们可以直接绕过。  第二种是:因为弱比较,所以如果我们比较一个  以数字开头但是后面是字母的 字符串时, 弱比较只会比较刚开始的数字是否相同。 所以这里就存在一个漏洞,我们可以查找那些 md5值 的开头数字值相同的 字符串,这样也可以绕过,下面我放几个我经常用的这种字符串,他们产生的md5 值 都是以 0e 开头:

接下来绕过 strcmp() 函数,这个函数同样可以传入 数组绕过:


login1

题目已经很明白的说了 是约束攻击,根据下面的链接了解一下原理,很简单就能做出来:

https://blog.youkuaiyun.com/qq_32400847/article/details/54137747

 

 

03-08
### WordPress Web Development Overview WordPress is a powerful and flexible content management system that can be used to build various types of websites, from simple blogs to complex applications[^1]. For developing with WordPress, understanding its architecture and components is essential. #### Setting Up the Environment To start with WordPress web development, one needs an environment where WordPress can run. This typically involves installing WordPress on a server or local machine using tools like WebStack which simplifies setup processes by automating configurations required for running WordPress efficiently. Once installed, accessing the initial setup page through a browser allows customization options such as entering site details including blog name and email address before finalizing installation via clicking 'Install WordPress' button[^2]. #### Customization Through Themes and Plugins A significant part of WordPress development revolves around customizing themes and plugins: - **Themes**: These control how your website looks visually. - **Plugins**: Extend functionality beyond core features provided out-of-the-box. Developers often modify existing ones or create new solutions tailored specifically towards project requirements. ```php // Example PHP code snippet demonstrating theme modification function my_custom_theme_setup() { add_theme_support('title-tag'); } add_action( 'after_setup_theme', 'my_custom_theme_setup' ); ``` This function adds support for automatic title tags within HTML documents generated by WordPress when this particular theme is active. #### Leveraging REST API for Advanced Functionality The introduction of the REST API has opened up possibilities for integrating external services directly into WordPress sites without needing extensive coding knowledge about internal structures. It enables developers to interact programmatically with almost every aspect of their installations remotely over HTTP requests. For instance, creating posts dynamically based on user input collected elsewhere becomes straightforward thanks to endpoints exposed under `/wp-json/wp/v2/posts`. ```javascript fetch('/wp-json/wp/v2/posts', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ title: "New Post Title", content: "Post Content Here" }) }) .then(response => response.json()) .catch(error => console.error('Error:', error)); ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值