Coder Social home page Coder Social logo

pathbrute's Introduction

pathbrute

Pathbrute

Pathbrute is a DirB/Dirbuster type of tool designed to brute force directories and files names on web/application servers.
However, it has some new tricks. It is no longer a dumb directories/files brute force tool if you use the -v and -i option.

It runs on Windows/Linux/OSX operating systems and on ARM/ARM64/x86/x64 processors.

Some of it includes:

  1. Wordlists from Exploit databases and Metasploit
  2. Identify interesting URLs eventhough websites return HTTP status code 200 for all URI paths.
  3. Identify valid paths that require authentication (HTTP status code 401)
  4. Reduce the number of results for wordlists with URI paths with nested directories (See #1 for more information)

Pathbrute has a number of wordlists from metasploit/exploit-database and other sources that it uses to discover interesting content on servers.

pathBrute contains/uses a number of self compiled wordlists for identifying “interesting” content and potentially vulnerable websites.

  1. More than 18899 URI paths from Exploit-Database
  2. More than 442 URI paths from Metasploit Framework
  3. More than 9745 URI paths from Packetstorm

pathBrute can also use wordlists from other sources if you prefer.
pathBrute can also be used for identifying if any type of CMS (Joomla, WordPress and Drupal) is running on the target websites and fingerprint the versions of the CMS using the –cms option.

Binaries for different platforms and architectures are available in the the release section.

Please check RELEASE section for compiled executables

$ ./pathBrute -h
Options:

  -h, --help       display help information
  -U, --filename   File containing list of websites
  -u, --url        Url of website
  -P, --Paths      File containing list of URI paths
  -p, --path       URI path
  -s, --source     Path source (default | msf | exploitdb | exploitdb-asp | exploitdb-aspx | exploitdb-cfm | exploitdb-cgi | exploitdb-cfm | exploitdb-jsp | exploitdb-perl | exploitdb-php | exploitdb-others | RobotsDisallowed | SecLists)
  -n, --threads    No of concurrent threads (default: 2)
  -c               Show only certain status code (e.g. -c 200)
  -e               Exclude certain status code (e.g. -e 404)
  -i               Intelligent mode
  -v, --verbose    Verbose mode
      --cms        Fingerprint CMS
  -x               Test a URI path across all target hosts instead of testing all URI paths against a host before moving onto next host
  -l, --log        Output to log file
  -r               Resume from x as in [x of 9999]
      --pHost      IP of HTTP proxy
      --pPort      Port of HTTP proxy (default 8080)
      --ua         Set User-Agent
      --timeout    Set timeout to x seconds
      --update     Update URI path wordlists from Github
      --skip       Skip sites that don't give any useful results (e.g. OWA, VPN, etc)
      --confirm    Confirm using more than 100 threads (use with -n option)
  -q, --query      Lookup URI paths that were found against ExploitDB)

Docker

  • Building from Dockerfile
docker build -t pathbrute .
docker run --rm pathbrute -u http://testphp.vulnweb.com/ -s default  -v -i -n 20
  • Pull latest Docker image
docker pull milo2012/pathbrute
docker run --rm pathbrute -u http://testphp.vulnweb.com/ -s default  -v -i -n 20
  • To see help menu
docker run --rm pathbrute -h

Compilation

#Manual Compilation  `
go get github.com/mkideal/cli
go get github.com/badoux/goscraper
go get github.com/fatih/color
go get github.com/hashicorp/go-version
go get github.com/xrash/smetrics
go get github.com/ti/nasync
go build pathBrute.go  

Example

./pathBrute -s default -f urls.txt -v -i -n 25 
[*] Getting Default Page Title for Invalid URI Paths
http://xxxx.com/xxx [code:404] [404 Not Found]

[*] Testing URI Paths
http://xxxx.com/AdminRealm [code:404] [168] [404 Not Found]
http://xxxx.com/AddressBookJ2WE/services/AddressBook/wsdl/ [code:404] [168] [404 Not Found]
http://xxxx.com/AdminJDBC [code:404] [168] [404 Not Found]
http://xxxx.com/AdminMain [code:404] [168] [404 Not Found]
http://xxxx.com/Admin [code:404] [168] [404 Not Found]
http://xxxx.com/AdminProps [code:404] [168] [404 Not Found]
http://xxxx.com/AddressBookJ2WB [code:404] [168] [404 Not Found]
http://xxxx.com/AE/index.jsp [code:404] [168] [404 Not Found]
http://xxxx.com/.web [code:404] [168] [404 Not Found]
http://xxxx.com/ADS-EJB [code:200] [482] []

[Found] https://127.0.0.1/.gitignore [code:200] [28] []
[Found] https://127.0.0.1/.htaccess [code:200] [1164] []
[Found] https://127.0.0.1/PMA/ [code:200] [8575] [phpMyAdmin]
[Found] https://127.0.0.1/.htaccess [code:200] [1164] []

Explanation of the output from pathBrute

https://208.88.199.241/sap/bc/webdynpro/sap/wdr_test_gantt [code:401] [458] [File or directory not found] [27736 of 38988]

Below is a description of the output from pathBrute

[401] - refers to the HTTP status code
[458] - refers to the size of the HTTP response
[File or directory not found] - refers to the title of the page
[27736 of 38988] - refers to the current position in the list


Example using the --cms option

Below is a sample output when using the --cms option to fingerprint the CMS on the target hosts. It also returns the Metasploit modules based on the version of the CMS software.

$ /git/pathbrute/pathBrute -U urls.txt --cms -i -v
[...redacted for brevity...]

[Found] https://[redacted] [Wordpress 4.8.6]

[Found] https://[redacted] [Wordpress 3.0]
Wordpress XML-RPC system.multicall Credential Collector [auxiliary/scanner/http/wordpress_multicall_creds]
WordPress Traversal Directory DoS [auxiliary/dos/http/wordpress_directory_traversal_dos]

[Found] https://[redacted] [Wordpress 3.8.26]
Wordpress XMLRPC DoS [auxiliary/dos/http/wordpress_xmlrpc_dos]
Wordpress XML-RPC system.multicall Credential Collector [auxiliary/scanner/http/wordpress_multicall_creds]
WordPress Traversal Directory DoS [auxiliary/dos/http/wordpress_directory_traversal_dos]

[Found] https://[redacted] [Wordpress 3.9.9]
Wordpress XML-RPC system.multicall Credential Collector [auxiliary/scanner/http/wordpress_multicall_creds]
WordPress Traversal Directory DoS [auxiliary/dos/http/wordpress_directory_traversal_dos]

[Found] https://[redacted] [Wordpress 3.3]
Wordpress XML-RPC system.multicall Credential Collector [auxiliary/scanner/http/wordpress_multicall_creds]
WordPress Traversal Directory DoS [auxiliary/dos/http/wordpress_directory_traversal_dos]

pathbrute's People

Contributors

chan9390 avatar milo2012 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pathbrute's Issues

proxy function not working

Hi
I am running pathbrute through the proxy and requests execute directly on Linux and MacOS bypassing http or socks5 proxy:
./pathBrute --update -u google.com -p test -v --pHost 127.0.0.1

[*] Testing URI Paths: (Total: 2)
http://google.com/test [404] [1565] [Error 404 (Not Found)!!1] [2 of 2]

[*] No results found

or even wrong IP, which should timeout or cause error
./pathBrute --update -u google.com -p test -v --pHost 123.123.123.123

[*] Testing URI Paths: (Total: 2)
http://google.com/test [404] [1565] [Error 404 (Not Found)!!1] [2 of 2]

[*] No results found

Optimization for Intelligent mode

This is placeholder for an issue I was trying to resolve. The website returns HTTP status code 200 for both the below 2 URI paths.

  1. /cjdynamicpollprov2/admin/admin_index.php
  2. /dreamfactory/dist/index.html#/launchpad

Path (1) is a false positive but the web server returns HTTP status code 200
Path (2) is a valid path

In order to determine or find the actual "valid" paths, I have implemented the below logic and code in 8f35b30.

[*] Pre-Bruteforce Checks
http://x.x.x.x/NonExistence [404] [2895] [Oops! 404!]

[*] Testing URI Paths: (Total: 2)
http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php [200] [64] [] [1 of 2]
http://x.x.x.x/dreamfactory/dist/index.html#/launchpad [200] [4309] [DreamFactory Services Platform] [2 of 2]


[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /xxx.jsp [404]
[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /NonExistence/xxx.jsp [200]
[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /cjdynamicpollprov2 [404]
[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /cjdynamicpollprov2/xxx/ [404]
[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /cjdynamicpollprov2/admin [404]
[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /cjdynamicpollprov2/admin/xxx/ [200]
[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /cjdynamicpollprov2/admin/admin_index.php [200]
[debug] http://x.x.x.x/cjdynamicpollprov2/admin/admin_index.php -> /cjdynamicpollprov2/admin/admin_index.php/xxx/ [200]

[debug] http://x.x.x.x/dreamfactory/dist/index.html#/launchpad -> /xxx.jsp [404]
[debug] http://x.x.x.x/dreamfactory/dist/index.html#/launchpad -> /NonExistence/xxx.jsp [200]
[debug] http://x.x.x.x/dreamfactory/dist/index.html#/launchpad -> /dreamfactory [403]
[debug] http://x.x.x.x/dreamfactory/dist/index.html#/launchpad -> /dreamfactory/xxx/ [404]
[debug] http://x.x.x.x/dreamfactory/dist/index.html#/launchpad -> /dreamfactory/dist [200]
[debug] http://x.x.x.x/dreamfactory/dist/index.html#/launchpad -> /dreamfactory/dist/xxx/ [404]

[Found] http://x.x.x.x/dreamfactory/dist/index.html [200] [4309] [DreamFactory Services Platform]

Reducing the number of results for wordlists with URI paths with nested directories

When using long word lists like "exploitdb_all.txt", some websites might return below results (which can include false positives).
We need to find out the actual valid paths and remove the other junk.

Below is a simplified example
Original results
[+] http://127.0.0.1/test/admin/index.php [200] [1027] []
[+] http://127.0.0.1/test/c99php3txt.php3 [200] [1027] []
[+] http://127.0.0.1/test/classifiedscript/admin.php [200] [1027] []
[+] http://127.0.0.1/test/cutenews-utf8/data/category.db.php [200] [1027] []
[+] http://127.0.0.1/test/cutenews/index.php [200] [1027] []
[+] http://127.0.0.1/test/cutenews/register.php [200] [1027] []
[+] http://127.0.0.1/test/cutenews/search.php [200] [1027] []
[+] http://127.0.0.1/test/efront/www/professor.php [200] [1027] []

Updated results with the -i [intelligent mode]
[+] http://127.0.0.1/test [200] [1027] []

The way I have done it is to slice the URI path /test/admin/index.php into parts and compare the status code and page size with one another.

If (1) has the same status code and page size as (2), and also the same as (3), we can effectively determine that (1)=(2)=(3). Therefore, we can remove (1) and (2) from the results and replace it with (3).

  1. [+] http://127.0.0.1/test/admin/index.php [200] [1027] []
  2. [+] http://127.0.0.1/test/admin [200] [1027] []
  3. [+] http://127.0.0.1/test [200] [1027] []

error running pathbrute

`fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x9d3bfc, 0x16)
/usr/lib/go-1.13/src/runtime/panic.go:774 +0x72
runtime.sysMap(0xc25c000000, 0x74000000, 0xe7c6f8)
/usr/lib/go-1.13/src/runtime/mem_linux.go:169 +0xc5
runtime.(*mheap).sysAlloc(0xe639a0, 0x72eaa000, 0x0, 0x7f2f7363d2a8)
/usr/lib/go-1.13/src/runtime/malloc.go:701 +0x1cd
runtime.(*mheap).grow(0xe639a0, 0x39755, 0xffffffff)
/usr/lib/go-1.13/src/runtime/mheap.go:1255 +0xa3
runtime.(*mheap).allocSpanLocked(0xe639a0, 0x39755, 0xe7c708, 0x425335)
/usr/lib/go-1.13/src/runtime/mheap.go:1170 +0x266
runtime.(*mheap).alloc_m(0xe639a0, 0x39755, 0x7f2f29810100, 0x7f2f29813f88)
/usr/lib/go-1.13/src/runtime/mheap.go:1022 +0xc2
runtime.(*mheap).alloc.func1()
/usr/lib/go-1.13/src/runtime/mheap.go:1093 +0x4c
runtime.(*mheap).alloc(0xe639a0, 0x39755, 0x7f2f6b010100, 0x7f2f29813f88)
/usr/lib/go-1.13/src/runtime/mheap.go:1092 +0x8a
runtime.largeAlloc(0x72eaa000, 0x450001, 0x7f2f29813f88)
/usr/lib/go-1.13/src/runtime/malloc.go:1138 +0x97
runtime.mallocgc.func1()
/usr/lib/go-1.13/src/runtime/malloc.go:1033 +0x46
runtime.systemstack(0x7f2f60000020)
/usr/lib/go-1.13/src/runtime/asm_amd64.s:370 +0x66
runtime.mstart()
/usr/lib/go-1.13/src/runtime/proc.go:1146

goroutine 1 [running]:`

Reduce number of results for HTTP Status Code 401

To reduce the number of matches for HTTP Status Code 401.
Original Code:
[*] Testing URI Paths: (Total: 10)
https://xxx.com/monitor/op5/nacoma/command_test.php [401] [401 Authorization Required] [2 of 10]
https://xxx.com/monitor/index.php/status/service/all [401] [401 Authorization Required] [1 of 10]

[Found] https://xxx.com/monitor/op5/nacoma/command_test.php [401] [401 Authorization Required]
[Found] https://xxx.com/monitor/index.php/status/service/all [401] [401 Authorization Required]

Amended Code:
[*] Testing URI Paths: (Total: 10)
https://xxx.com/monitor/op5/nacoma/command_test.php [401] [401 Authorization Required] [2 of 10]
https://xxx.com/monitor/index.php/status/service/all [401] [401 Authorization Required] [1 of 10]

[Found] https://xxx.com/monitor [401] [401 Authorization Required]

Feature: Remove pathBrute_osx and pathBrute_linux from master

Hey,

I can see that the compiled files pathBrute_osx and pathBrute_linux are included in the master branch. Also the executables are compiled for different OS & architectures and are made available at releases page. I would suggest you to remove them from the branch as it would take away more space (considering the project in long term).

If you have included them just for the sake of Dockerfile, you can change the command ADD pathBrute_linux / to a bunch of commands which includes installing wget, download the executable from release and then executing it.

License Information

Hi,
Really great work guys! I really appreciate the project and the efforts you guys have put into it. We would like to use the project for a commercial training online/classroom. So, I just wanted to clarify, if we acknowledge the source, would that be sufficient and covered under the terms of use?

Thanks.

additonal requirements

more of a notice...
manual compilation reads..
go github.com/hashicorp/go-version
however, it should be
go get github.com/hashicorp/go-version correct?

also, maybe consider putting the following in readme for manual compilation as they came up as a requirement to successfully build for me...

go get github.com/xrash/smetrics
go get github.com/ti/nasync

clean install missing tools

Hello,
For fresh install on MacOS following "Manual Compilation" guide the following were missing to make it work.
xcode-select —install
got get github.com/mattn/go-sqlite3

error:

go build pathBrute.go
pathBrute.go:29:5: cannot find package "github.com/mattn/go-sqlite3" in any of:
/usr/local/Cellar/go/1.12.7/libexec/src/github.com/mattn/go-sqlite3 (from $GOROOT)
/Users/user/go/src/github.com/mattn/go-sqlite3 (from $GOPATH)

Output file functionality

Can you add a functionality where all the results for response codes can be output into a text file or any file format ??

source

Enhancement:

Please add all for the source so that it can check all the path from all of the wordlists.

Lookup URI paths that were found and compare them against DB for ExploitDB, Packetstorm and Metasploit Framework.

Below is an example

$ ./pathBrute -u http://xx.xx.xx.xx -p /e/enews/index.php -x -v -i
[*] Pre-Bruteforce Checks
http://xx.xx.xx.xx/NonExistence [404] [1263] [404错误页面]

[*] Testing URI Paths: (Total: 1)
http://xx.xx.xx.xx/e/enews/index.php [200] [1064] [message notification] [1 of 1]
[Found] http://xx.xx.xx.xx/e/enews/index.php [200] [1064] [message notification]

Below is the additional output that will be added

[*] Database Lookup
[Source]	    [Filename]	    [URI Path]		       [Vuln Category]
exploitdb	    10069.php	    /e/enews/index.php	        sql

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.