Code Monkey home page Code Monkey logo

intrigue-ident's Introduction

Notice

As of October 1, 2021, this component of the Intrigue project is no longer actively maintained at this location, and the code in this repository has been re-licensed under the terms of the Mandiant Limited Open Source License Agreement (see: LICENSE.md).

About:

Ident is an application and service fingerprinting library used within Intrigue Core.

The Ident project has a few stated goals:

  • To deeply identify network service and app software while remaining extremely fast - limiting unnecessary requests
  • To have the most complete set of identification checks for modern application and server software
  • To integrate well as a library, for easy use in other projects such as Intrigue Core
  • To maintain a robust command line interface for use as a standalone tool
  • To be commercially viable through use of the BSD license

Ident is written in Ruby and uses the lightning fast libcurl-backed Typhoeus and the powerful Socketry libraries to make requests.

Below, find instruction on how to get stated:

Using ident via Docker image:

  1. Pull and run the docker image! It'll download directly from DockerHub if the image doesnt exist locally docker run -t intrigueio/intrigue-ident -u https://intrigue.io

Usage:

$ bundle exec ruby ./util/ident.rb -c -v -u https://xyz.com:443
Checking... https://xyz.com:443
Fingerprint:
 - PHP PHP 5.4.16  - x-powered-by header (CPE: cpe:2.3:a:php:php:5.4.16:) (Tags: ["Web Framework"])
   - Vuln: CVE-2016-5768 (CVSSv3: 9.8)
   - Vuln: CVE-2016-4538 (CVSSv3: 9.8)
 - PHP PHP   - PHPSESSID cookie (CPE: cpe:2.3:a:php:php::) (Tags: ["Web Framework"])
 - Apache HTTP Server 2.4.6  - Apache web server - server header - with versions (CPE: cpe:2.3:a:apache:http_server:2.4.6:) (Tags: ["Web Server"])
   - Vuln: CVE-2018-1312 (CVSSv3: 9.8)
   - Vuln: CVE-2017-15715 (CVSSv3: 8.1)
 - Wordpress Wordpress   - common link (CPE: cpe:2.3:a:wordpress:wordpress::) (Tags: ["CMS"])
 - Yoast Wordpress SEO   - unique string (CPE: cpe:2.3:a:yoast:wordpress_seo::) (Tags: ["Marketing", "Wordpress Plugin"])
 - Bootstrap Bootstrap   - boostrap css (CPE: cpe:2.3:a:bootstrap:bootstrap::) (Tags: ["Web Framework"])
 - OpenSSL OpenSSL 1.0.2k-fips  - server header (CPE: cpe:2.3:a:openssl:openssl:1.0.2k-fips:) (Tags: ["Library"])
   - Vuln: CVE-2018-0732 (CVSSv3: 7.5)
Content Checks:
 - Authentication - HTTP: false
 - Authentication - Session Identifier: true
 - Google Analytics Account Detected: false
 - Location Header:
 - Directory Listing Detected: false
 - Form Detected: false
 - File Upload Form Detected: false
 - Email Addresses Detected: []
 - Access-Control-Allow-Origin Header: false
 - P3P Header: false
 - X-Frame-Options Header: true
 - X-XSS-Protection Header: false

For Check Writers:

Check types can be written against supported protocols:

  • AMQP
  • Apache Zookeeper Atomic Broadcast (Raw)
  • Cisco Smart Install
  • DNS
  • Elasticsearch
  • FTP
  • Ganglia (Raw)
  • HTTP / HTTPS
  • Memcached (Raw)
  • Mongodb
  • Mysql
  • Oracle IIOP (Raw)
  • Oracle T3 (Raw)
  • Pop3
  • RDP (Raw)
  • Redis
  • SAP NI (Raw)
  • SMB
  • SMTP
  • SNMP
  • SSH
  • Telnet

Generally speaking, checks have the following structure. This is a check for HTTP and HTTPS:

 [
        {
          type: "fingerprint",
          category: "service",
          vendor: "Some",
          product: "Product",
          website: "https://www.somewhere.co.uk/",
          match_logic: :all,
          matches: [
            {
              match_type: :content_title,
              match_content: /The Title of the Page/i
            },
            {
              match_type: :content_body,
              match_content: /any body string/i
            },
            {
              match_type: :content_code,
              match_content: 200
            }
          ],
          description: "just an example check",
          paths: [ { path: "#{url}", follow_redirects: true } ]
        }
      ]

There are many types of matchers, which tell the check what part of the target's response to check.

 - content_body: checks should be run against body
 - content_code: checks should be run against code returned in the response as an integer (note that this is generally only useful for follow-on checks)
 - content_cookies: checks should be run against the set-cookie: header (do not include the header name, just the content when writing checks)
 - content_generator:  checks should be run against text inside the <meta generator> tag (do not include the tag when writing checks)
 - content_headers: checks should be run against response headers (assumes one string of text, each header '\n' delimited)
 - content_title: checks should be run against text inside the <title> tag (do not include the tag when writing checks)

Multiple matches per check are supported, see: #87

For more details, have a look at the checks in the 'checks' directory, or jump into our slack channel for help.

Contributors:

A special thanks to the following contributors who help make ident awesome!

  • @adambakalar: Protocol support and Fingerprints
  • @duartemateus: Bugfixes, Architecture, Protocol support and Fingerprints
  • @chowdud: Fingerprints++ **
  • @jen140: Fingerprints
  • @shpendk: Fingerprints, Architecture
  • @m-q-t: Fingerprints, Architecture
  • @bensalah_anas: Fingerprints
  • @bcoles: Fingerprints, Bugfixes, JSON output
  • @bmcdevitt: Fingerprints
  • @retornam: Dockerization

intrigue-ident's People

Contributors

adambakalar avatar anasbensalah avatar bcoles avatar chowdud avatar dependabot[bot] avatar duartemateus avatar epicfaace avatar jcran avatar jen140 avatar m-q-t avatar marmelatze avatar mosesrenegade avatar retornam avatar shpendk 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

intrigue-ident's Issues

implement follow-on checks

As a user looking to fingerprint things quickly, it'd be handy if ident was smart enough to do an initial check against a single (or small set) of urls, then run follow-on checks for stuff that is specific to a given product.

Note that this increases the importance and difficulty of getting the initial checks right, but extends the usefulness of ident by significantly speeding it up in the general case. Some tech may need to be revisited to see if we can address fingerprinting it with just the base url.

nginx fingerprinting not working correctly (possibly because of the redirect)

Running the latest docker image one host doesn't fingerprint the server as nginx.

How to reproduce:
docker pull intrigueio/intrigue-ident && docker run -t intrigueio/intrigue-ident --url http://server.amconstruct1.com:8080

Output:

Checking URL: http://server.amconstruct1.com:8080
Fingerprint:

curl --head http://server.amconstruct1.com:8080

HTTP/1.1 302 Found
cache-control: max-age=0, private, must-revalidate
connection: close
content-length: 11
date: Thu, 12 Mar 2020 14:51:32 GMT
location: http://survey-smiles.com
server: nginx
set-cookie: sid=f6e916ac-6470-11ea-9d4c-692b809f72b1; path=/; domain=.amconstruct1.com; expires=Tue, 30 Mar 2088 18:05:39 GMT; max-age=2147483647; HttpOnly

Expected output(example domain "DISTINCTIVEINDUSTRIES.com" was used, it also reports simple "server: nginx" ):

Checking URL: http://DISTINCTIVEINDUSTRIES.com
Fingerprint:
 - Nginx Nginx   - Nginx (CPE: cpe:2.3:a:nginx:nginx::) (Tags: ["Web Server"]) (Hide: false)

curl --head http://DISTINCTIVEINDUSTRIES.com

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 12 Mar 2020 14:51:15 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
Expires: Wed, 17 Aug 2005 00:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: 2863bf481cda1bd44e4fb03af25b5843=f454d5edd431232714564a97f54a7b86; path=/; HttpOnly
Last-Modified: Thu, 12 Mar 2020 14:51:15 GMT

Error with bundle?

Ran build on the latest Dockerfile --

Step 9/10 : RUN bundle install
 ---> Running in f9e1e186a768
You must use Bundler 2 or greater with this lockfile.
The command '/bin/sh -c bundle install' returned a non-zero code: 20

Failing because of pop3

This is on the latest master (2.0.7):

 /app/intrigue-ident/lib/ident.rb:103:in `require_relative': cannot load such file -- /app/intrigue-ident/checks/pop3/base (LoadError)
        from /app/intrigue-ident/lib/ident.rb:103:in `<top (required)>'
        from ./util/ident.rb:2:in `require_relative'
        from ./util/ident.rb:2:in `<main>'
 1

No output created and program gives error

Hello, devs!

I'm running ident like this:

docker run --cpu-shares 1024 --rm  -v dockerresults:/dockerresults intrigueio/intrigue-ident --threads 10 --debug --file /dockerresults/whatweb699507042838/whatwebhttpx.txt --json

inside the file there are urls, 1 url per line.

I'm getting this error message:

./util/ident.rb:122:in `write_simple_csv': wrong number of arguments (given 1, expected 2) (ArgumentError)
	from ./util/ident.rb:213:in `check_uris_from_file'
	from ./util/ident.rb:117:in `main'
	from ./util/ident.rb:275:in `<main>'
	

Could you help me please, what am I doing wrong?

support for fingerprinting each endpoint in a redirect chain

As a user, it'd be super handy if you'd fingerprint each endpoint as i hit it during a redirect chain. This would allow me to identify more assets. Note that this behavior should be optional, as it's not always intuitive that you'd combine endpoints like this.

EXCEPTION! undefined local variable or method `enable_browser' for main:Object

Trying to run the docker image and give it a list of URLs to scan with browser enabled:
docker run -v /root/urls:/mnt/localurls -t intrigueio/intrigue-ident --file /mnt/localurls/targeturls.txt --browser true

Get an error:
EXCEPTION! undefined local variable or method enable_browser' for main:Object Traceback (most recent call last): from ./util/ident.rb:291:in

'
from ./util/ident.rb:281:in main' from ./util/ident.rb:99:in check_file_urls'
./util/ident.rb:99:in `pop': queue empty (ThreadError)

It seems to me, that the variable enable_browser is not defined in function check_file_urls in util/ident.rb, thus the error.

`ident_create_browser_session': uninitialized constant Intrigue::Config

Trying to run docker image for a single url with browser enabled:
docker run -t intrigueio/intrigue-ident --browser true --url https://google.com

Get an error:
Checking URL: https://google.com
Traceback (most recent call last):
from ./util/ident.rb:291:in <main>' from ./util/ident.rb:275:in main'
from ./util/ident.rb:156:in check_single_url' from /home/ident/lib/ident.rb:192:in generate_http_requests_and_check'
from /home/ident/lib/ident.rb:192:in each' from /home/ident/lib/ident.rb:218:in block in generate_http_requests_and_check'
/home/ident/lib/http/browser.rb:17:in `ident_create_browser_session': uninitialized constant Intrigue::Config (NameError)

target input should come via uri

Today, in order to scan anything other than a URL, you have to enter a --ip option and (optionally) specify the port.

URIs are a much more consistent way to specify input...

Rather than doing something like:
./util/ident.rb --ip 1.1.1.1 --port 25

it'd be better if you could do something like:
./util/ident.rb --uri smtp:1.1.1.1:25

Address this for all supported protocols

via @bcoles

Ident should use JSON to hold its fingerprints instead of Ruby hashmaps

Using JSON files or any other non language specific data storage format to hold your fingerprints will make it a lot easier for other languages to use your fingerprints. You have done some amazing work here I and I'm sure others would love to use your fingerprints in our personal tools.

false positive on open redirect check

Your open redirect check has this regex in it:

/\?url=http/i

But that is used by quite a few other things, on my site, most of the social media links match it:

<a title="Share on Twitter" id="twitter-share" href="https://twitter.com/share?text=DigiNinja&amp;url=https://digi.ninja/index.php" rel="noopener" target="_blank"><i class="fa fa-twitter"></i></a>

I think it is too vague a check to determine open redirect based off that. It also took me a while to track down why you thought there was an open redirect, maybe giving the reason for the decision would be good as it would help determine whether it is a false positive or not.

Misidentification of "Apache Coyote 1.1"

Intrigue ident misidentifies Apache Tomcat as "Apache Coyote 1.1". In fact, the "Apache-Coyote/1.1" "Server" header is only sent back from versions of Apache Tomcat from 4.1.x to 8.0.x (see https://tomcat.apache.org/tomcat-7.0-doc/security-howto.html).

I get a result such as the following:

cpe: "cpe:2.3:a:apache:coyote:1.1:"
hide: false
inference: true
issues: null
match_details: "Apache coyote application server - server header"
match_type: "content_headers"
method: "ident"
product: "Coyote"
tags: ["Application Server"]
0: "Application Server"
tasks: null
type: "fingerprint"
update: null
vendor: "Apache"
version: "1.1"

ident cli should generate json/csv output

the cli's export output needs to be reworked.

the json / csv options are commented out, and dropping an output.csv in the working directory isn't desirable, and no csv is generated if you're targeting a single URL/IP.

via @bcoles

Webresource.asmx should be a secondary check

As surfaced in the comments on #20, Webresource.asmx is being requested as a first-round resource. Figure out which check is requesting it, and make it a follow-on check to ASP.net.

Checking URL: http://server.amconstruct1.com:8080
Getting http://server.amconstruct1.com:8080
Getting http://server.amconstruct1.com:8080/api
Getting http://server.amconstruct1.com:8080/doesntexist-123
Getting http://server.amconstruct1.com:8080/WebResource.asmx
Getting http://server.amconstruct1.com:8080/admin
Getting http://server.amconstruct1.com:8080/error.json
Ran 576 checks against base URL
Fingerprint:
 - Nginx Nginx   - Nginx (no version) (CPE: cpe:2.3:a:nginx:nginx::) (Tags: ["Web Server"]) (Hide: false)

Content checks should be less verbose

See #8 as well, but this sort of verbosity around content checks is unnecessary. Save it for the JSON/CSV output. For the CLI, only print stuff that would be useful to a tester.

Specifically:

  • remove location header
  • remove security header info if they don't print something that can be actioned
  • remove anything that's 'false'
  • remove email addresses output if there are none.
Checking URL: http://127.0.0.1/
Checking... http://127.0.0.1/
Fingerprint:
 - Apache HTTP Server 2.4.41  - Apache web server - server header - with versions (CPE: cpe:2.3:a:apache:http_server:2.4.41:) (Tags: ["Web Server"])
Content Checks:
 - Access-Control-Allow-Origin Header: false
 - P3P Header: false
 - X-Frame-Options Header: false
 - X-XSS-Protection Header: false
 - Google Analytics Account Detected: false
 - Location Header: 
 - Directory Listing Detected: false
 - Form Detected: false
 - File Upload Form Detected: false
 - Email Addresses Detected: []
 - Authentication - HTTP: false
 - Authentication - Session Identifier: false````

via @bcoles 

security header content checks should do something useful

The security header content checks currently only check for the existence of the header, which is next to useless. It'd be far better if they actually verified / checked the value/content of the header.

For example:

{
        :type => "content",
        :name => "Access-Control-Allow-Origin Header",
        :match_type => :content_headers,
        :dynamic_result => lambda { |d|
          return true if _first_header_match d, /^Access-Control-Allow-Origin:.*/i;
        false
        },
        :dynamic_hide => lambda { |d| false },
        :dynamic_issue => lambda { |d| false },
        :paths => ["#{url}"]
      },

and

{
        :type => "content",
        :name => "X-Frame-Options Header",
        :match_type => :content_headers,
        :dynamic_result => lambda { |d|
          return true if _first_header_match d, /^x-frame-options:.*/i;
        false
        },
        :dynamic_hide => lambda { |d| false },
        :dynamic_issue => lambda { |d| false },
        :paths => ["#{url}"]
      },```

but the header could be `X-Frame-Options: kill all humans` .. 

in addition, many applications will not respond with a CORS header unless the client request contains an `Origin` header

via @bcoles 

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.