<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tech Chronicles</title>
	<atom:link href="http://kostacipo.stream/feed/" rel="self" type="application/rss+xml" />
	<link>http://kostacipo.stream/</link>
	<description>Ramblings of a Tech Dude</description>
	<lastBuildDate>Fri, 25 Jul 2025 20:53:06 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>

<image>
	<url>https://kostacipo.stream/wp-content/uploads/2019/12/cropped-profile-32x32.jpg</url>
	<title>Tech Chronicles</title>
	<link>http://kostacipo.stream/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Modular Distributed Fingerprinting Engine – Scannerl</title>
		<link>http://kostacipo.stream/modular-distributed-fingerprinting-engine-scannerl/</link>
					<comments>http://kostacipo.stream/modular-distributed-fingerprinting-engine-scannerl/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Fri, 25 Jul 2025 20:53:06 +0000</pubDate>
				<category><![CDATA[Information Gathering]]></category>
		<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Detection]]></category>
		<category><![CDATA[Distributed scanning]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Fingerprinting]]></category>
		<category><![CDATA[Network Analysis]]></category>
		<category><![CDATA[Network Scanner]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2224</guid>

					<description><![CDATA[<p>Introduction Scannerl is a modular, distributed fingerprinting engine implemented in Erlang. It can scan very large number of targets on a single host, but also can be distributed across multiple hosts. This tool is tested on Linux (Ubuntu, Debian, Arch &#38; Kali Linux), but should work on other Linux distros, too. Fingerprinting implies analyzing networks for vulnerabilities. The purpose is to [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/modular-distributed-fingerprinting-engine-scannerl/">Modular Distributed Fingerprinting Engine – Scannerl</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h3>Introduction</h3>
<p>Scannerl is a modular, distributed fingerprinting engine implemented in <a href="https://www.erlang.org/" target="_blank" rel="noopener nofolloq">Erlang</a>. It can scan very large number of targets on a single host, but also can be distributed across multiple hosts. This tool is tested on Linux (Ubuntu, Debian, Arch &amp; Kali Linux), but should work on other Linux distros, too.</p>
<div class="alert alert-info">Fingerprinting implies analyzing networks for vulnerabilities. The purpose is to accumulate as much information as possible, including the target’s OS, database version, configurations, architecture, etc. Therefore, attacker can identify OS information (version, nodes, etc) that run on specific target and find which vulnerabilities to exploit.<br />
The remote fingerprinting can be classified in two categories: active and passive. In active fingerprinting we can send specifically created packets to the target machine and monitor the response. In passive fingerprinting we can sniff TCP/IP ports and monitor traffic between machine and nodes. Passive fingerprinting is less accurate than active fingerprinting, but pentesters and hackers often opt for this technique when they want to avoid detection.</div>
<h2>Scannerl: Modular Distributed Fingerprinting Engine</h2>
<p>Scannerl is an open source distributed fingerprinting tool developed by <a href="https://www.kudelskisecurity.com/" target="_blank" rel="nofollow noopener">Kudelski Security</a>. There are other fingerprinting tools, but those tools come with different limitations/problems such as: scanning on a few hosts at the time (not suitable for large IP addresses ranges); higher probability of being blacklisted, if large IP addresses range is protected by IPS devices (incomplete information). Scannerl successfully fights these limitations, therefore you can fingerprint multiple hosts simultaneously.</p>
<p>What is ZMap to port scanning, Scannerl is to fingerprinting. So, if you are planning large-scale fingerprinting sessions, this tool is the right choice. You can use it on a single host, but you can also easily distribute work over several machines.</p>
<h3>Features:</h3>
<ul>
<li>Fast: With Scannerl you can spread the tasks across multiple hosts and increase the overall performance. Other fingerprinting tools are limited by the available resources of the host they run on (network card, CPU, RAM, network bandwidth, etc.). Cluster of virtual servers will be enough to perform large-scale scans, there is no need for high-end server.</li>
<li>Distributed:  Master/Slave architecture enables workload across different hosts. Process is easy and transparent, you’ll only need to provide the hosts to use.</li>
<li>Scalable: Thanks to Erlang’s small sized processes, the tool can execute a large number of tasks in parallel, on the same host. Since Scannerl has ability to distribute the work across different hosts, we can say that it’s high-functioning and easily scalable tool.</li>
<li>Modular: You can easily add custom modules in order to fingerprint specific protocols and services in a few lines of code. In addition, it’s possible to add output modules to insert any results directly into a database technology of your choice.</li>
<li>Stealth: Reduced chance of being blocked. When using a single host to fingerprint a large number of IPs, there are high possabilites that ISPs/Firewalls might block your probes. But with Scannerl you can distribute your scan among several IP addresses and reduce the chance to be blocked.</li>
<li>Smart: Scannerl can retrieve specific information from a fingerprint session (a field in the header, the version, etc.).</li>
</ul>
<h3>Requirements:</h3>
<ul>
<li>Erlang v18+</li>
</ul>
<h3>Modules</h3>
<p>This fingerprinting tool is very modular, therefore it’s easy to add new modules at compile time or dynamically (external file). Available modules:</p>
<div class="row justify-content-center">
<div class="card-deck">
<div class="col-12 col-lg-6">
<div class="card mb-2">
<h4 class="card-header bg-white text-center">Fingerprinting modules</h4>
<div class="card-body">
<ul>
<li><code>bacnet</code>: Bacnet identification</li>
<li><code>chargen</code>: Chargen amplification factor identification</li>
<li><code>fox</code>: FOX identification</li>
<li><code>httpbg</code>: HTTP Server header identification</li>
<li><code>httpsbg</code>: HTTPS Server header identification</li>
<li><code>https_certif</code>: HTTPS certificate graber</li>
<li><code>imap_certif</code>: IMAP STARTTLS certificate graber</li>
<li><code>modbus</code>: Modbus identification</li>
<li><code>mqtt</code>: MQTT identification</li>
<li><code>mqtts</code>: MQTT over SSL identification</li>
<li><code>mysql_greeting</code>: Mysql version identification</li>
<li><code>pop3_certif</code>: POP3 STARTTLS certificate graber</li>
<li><code>smtp_certif</code>: SMTP STARTTLS certificate graber</li>
<li><code>ssh_host_key</code>: SSH host key graber</li>
</ul>
</div>
</div>
</div>
<div class="col-12 col-lg-6">
<div class="card">
<h4 class="card-header bg-white text-center">Output modules</h4>
<div class="card-body">
<ul>
<li><code>csv</code>: output to csv</li>
<li><code>csvfile</code>: output to csv file</li>
<li><code>file</code>: output to file</li>
<li><code>file_ip</code>: output to stdout (only IP)</li>
<li><code>file_mini</code>: output to file (only IP and result)</li>
<li><code>file_resultonly</code>: output to file (only result)</li>
<li><code>stdout</code>: output to stdout</li>
<li><code>stdout_ip</code>: output to stdout (only IP)</li>
<li><code>stdout_mini</code>: output to stdout (only IP and result)</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<h2>Install</h2>
<p>To build from source and to use Scannerl, first you need to install <a href="https://www.erlang-solutions.com/resources/download.html" target="_blank" rel="nofollow noopener">Erlang/OTP:</a></p>
<ul>
<li>
<h4>Debian</h4>
</li>
</ul>
<pre>$ sudo apt install erlang erlang-src rebar</pre>
<ul>
<li>
<h4>Arch</h4>
</li>
</ul>
<pre>$ sudo pacman -S erlang-nox rebar</pre>
<p>Then clone Scannerl from the github repo, and build:</p>
<pre>$ git clone https://github.com/kudelskisecurity/scannerl.git
$ <span class="pl-c1">cd</span> scannerl
$ ./build.sh</pre>
<ul>
<li>
<h4>Kali</h4>
</li>
</ul>
<p>First install dependencies:</p>
<pre>$ sudo apt install libssl-dev automake autoconf libncurses5-dev</pre>
<p>Then install <a href="https://github.com/erlang/rebar3" target="_blank" rel="nofollow noopener">rebar</a> (Erlang build tool for compiling and testing Erlang applications):</p>
<pre>$ <span class="pl-c1">cd</span> /tmp
$ git clone git://github.com/rebar/rebar.git<span class="pl-k">;</span> <span class="pl-c1">cd</span> rebar
$ ./bootstrap
$ sudo cp rebar /usr/local/bin/rebar</pre>
<p>Install <a href="https://github.com/kerl/kerl" target="_blank" rel="nofollow noopener">kerl</a> and Erlang/OTP 20.1</p>
<pre>$ <span class="pl-c1">cd</span> /tmp
$ curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
$ chmod +x kerl
$ sudo cp kerl /usr/local/bin/kerl
$ kerl build 20.1 20.1
$ sudo mkdir /opt/kerl<span class="pl-k">;</span> sudo chown -R <span class="pl-smi">$USER</span> /opt/kerl
$ kerl install 20.1 /opt/kerl/20.1</pre>
<p>Then you’ll be able to build Scannerl:</p>
<pre>$ <span class="pl-c1">source</span> /opt/kerl/20.1/activate
$ git clone https://github.com/kudelskisecurity/scannerl.git
$ <span class="pl-c1">cd</span> scannerl
$ ./build.sh</pre>
<h2>Basic Usage</h2>
<pre>$ ./scannerl -h
   ____   ____    _    _   _ _   _ _____ ____  _
  / ___| / ___|  / \  | \ | | \ | | ____|  _ \| |
  \___ \| |     / _ \ |  \| |  \| |  _| | |_) | |
   ___) | |___ / ___ \| |\  | |\  | |___|  _ &lt;| |___
  |____/ \____/_/   \_\_| \_|_| \_|_____|_| \_\_____|

USAGE
  scannerl MODULE TARGETS [NODES] [OPTIONS]

  MODULE:
    -m &lt;mod&gt; --module &lt;mod&gt;
      mod: the fingerprinting module to use.
           arguments are separated with a colon.

  TARGETS:
    -f &lt;target&gt; --target &lt;target&gt;
      target: a list of target separated by a comma.
    -F &lt;path&gt; --target-file &lt;path&gt;
      path: the path of the file containing one target per line.
    -d &lt;domain&gt; --domain &lt;domain&gt;
      domain: a list of domains separated by a comma.
    -D &lt;path&gt; --domain-file &lt;path&gt;
      path: the path of the file containing one domain per line.

  NODES:
    -s &lt;node&gt; --slave &lt;node&gt;
      node: a list of node (hostnames not IPs) separated by a comma.
    -S &lt;path&gt; --slave-file &lt;path&gt;
      path: the path of the file containing one node per line.
            a node can also be supplied with a multiplier (&lt;node&gt;*&lt;nb&gt;).

  OPTIONS:
    -o &lt;mod&gt; --output &lt;mod&gt;     comma separated list of output module(s) to use.
    -p &lt;port&gt; --port &lt;port&gt;     the port to fingerprint.
    -t &lt;sec&gt; --timeout &lt;sec&gt;    the fingerprinting process timeout.
    -T &lt;sec&gt; --stimeout &lt;sec&gt;   slave connection timeout (default: 10).
    -j &lt;nb&gt; --max-pkt &lt;nb&gt;      max pkt to receive (int or "infinity").
    -r &lt;nb&gt; --retry &lt;nb&gt;        retry counter (default: 0).
    -c &lt;cidr&gt; --prefix &lt;cidr&gt;   sub-divide range with prefix &gt; cidr (default: 24).
    -M &lt;port&gt; --message &lt;port&gt;  port to listen for message (default: 57005).
    -P &lt;nb&gt; --process &lt;nb&gt;      max simultaneous process per node (default: 28232).
    -Q &lt;nb&gt; --queue &lt;nb&gt;        max nb unprocessed results in queue (default: infinity).
    -C &lt;path&gt; --config &lt;path&gt;   read arguments from file, one per line.
    -O &lt;mode&gt; --outmode &lt;mode&gt;  0: on Master, 1: on slave, &gt;1: on broker (default: 0).
    -v &lt;val&gt; --verbose &lt;val&gt;    be verbose (0 &lt;= int &lt;= 255).
    -K &lt;opt&gt; --socket &lt;opt&gt;     comma separated socket option (key[:value]).
    -l --list-modules           list available fp/out modules.
    -V --list-debug             list available debug options.
    -A --print-args             Output the args record.
    -X --priv-ports             use only source port between 1 and 1024.
    -N --nosafe                 keep going even if some slaves fail to start.
    -w --www                    DNS will try for www.&lt;domain&gt;.
    -b --progress               show progress.
    -x --dryrun                 dry run.</pre>
<h2>Distributed scan [setup &amp; usage]</h2>
<p>In order to perform distributed scan, you’ll need:</p>
<ul>
<li>Master node: to run Scannerl’s binary (needs installed Scannerl)</li>
<li>Slave node(s): to connect Scannerl (need installed Erlang)</li>
</ul>
<p>Requirements – all hosts:</p>
<ul>
<li>have the same version of Erlang installed</li>
<li>are able to connect to each other using SSH public key</li>
<li>names resolve (use <em>/etc/hosts</em> if no proper DNS is setup)</li>
<li>have the same <a href="http://erlang.org/doc/reference_manual/distributed.html" target="_blank" rel="nofollow noopener">Erlang security cookie</a></li>
<li>must allow connection to Erlang EPMD port (<code>TCP/4369</code>)</li>
<li>have the following range of ports opened: <code>TCP/11100</code> to <code>TCP/11100</code> + <code><em>number-of-slaves</em></code></li>
</ul>
<p>To use, provide a list of slaves – example (<code> -s </code>or <code>-S </code>switches):</p>
<div class="highlight highlight-source-shell">
<pre>$ ./scannerl -m httpbg -d example.com -s host1,host2,host3</pre>
<p>To list all available modules, type <code>-l</code>:</p>
<pre>$ ./scannerl -l
</pre>
</div>
<h2>Standalone usage</h2>
<p>You can use Scannerl on the local host without any other host, but the slave will be created anyway. So, you’ll need to fulfill same requirements described above. Make sure your host is able to resolve itself with the following:</p>
<pre>$ grep -q <span class="pl-s"><span class="pl-pds">"</span>127.0.1.1\s*<span class="pl-pds">`</span>hostname<span class="pl-pds">`</span><span class="pl-pds">"</span></span> /etc/hosts <span class="pl-k">||</span> <span class="pl-c1">echo</span> <span class="pl-s"><span class="pl-pds">"</span>127.0.1.1 <span class="pl-pds">`</span>hostname<span class="pl-pds">`</span><span class="pl-pds">"</span></span> <span class="pl-k">|</span> sudo tee -a /etc/hosts</pre>
<p>Then create SSH key and add it to the <code>authorized_keys.</code> It’s assumed that you have SSH server running:</p>
<pre>$ cat <span class="pl-smi">$HOME</span>/.ssh/id_rsa.pub <span class="pl-k">&gt;&gt;</span> <span class="pl-smi">$HOME</span>/.ssh/authorized_keys</pre>
<p>Standalone scan example:</p>
<pre>$ ./scannerl -m httpbg -d example.com</pre>
<p><a href="https://github.com/kudelskisecurity/scannerl/wiki">Documentation</a><br />
<a href="https://github.com/kudelskisecurity/scannerl">Download</a></p>
<p>The post <a href="http://kostacipo.stream/modular-distributed-fingerprinting-engine-scannerl/">Modular Distributed Fingerprinting Engine – Scannerl</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/modular-distributed-fingerprinting-engine-scannerl/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>AutoSploit: Automated Mass Exploiter</title>
		<link>http://kostacipo.stream/autosploit-automated-mass-exploiter/</link>
					<comments>http://kostacipo.stream/autosploit-automated-mass-exploiter/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Fri, 25 Jul 2025 20:43:36 +0000</pubDate>
				<category><![CDATA[Exploitation Tools]]></category>
		<category><![CDATA[Exploit]]></category>
		<category><![CDATA[metasploit]]></category>
		<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2219</guid>

					<description><![CDATA[<p>AutoSploit is a powerful hacking tool that has the ability to automate exploitation operations on remote hosts. This tool enables you to perform mass exploitations on the system being targeted by utilizing the services offered by Shodan, Censys, Zoomeye and Metasploit. This tool is developed using Python. Autosploit: Advanced Remote Host Mass Exploitation With this tool, [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/autosploit-automated-mass-exploiter/">AutoSploit: Automated Mass Exploiter</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="text-justify">AutoSploit is a powerful hacking tool that has the ability to automate exploitation operations on remote hosts. This tool enables you to perform mass exploitations on the system being targeted by utilizing the services offered by <a href="https://www.shodan.io/">Shodan</a>, <a href="https://censys.io/">Censys</a>, <a href="https://www.zoomeye.org/">Zoomeye </a>and Metasploit. This tool is developed using Python.</p>
<figure class="wp-block-image size-large img-fluid text-center"><img decoding="async" class="wp-image-11728 lazyloaded" src="https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo.jpg" sizes="(max-width: 1000px) 100vw, 1000px" srcset="https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo.jpg 1000w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-300x54.jpg 300w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-768x138.jpg 768w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-350x63.jpg 350w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-500x90.jpg 500w" alt="AutoSploit: Automated Mass Exploiter Logo/Banner" data-srcset="https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo.jpg 1000w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-300x54.jpg 300w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-768x138.jpg 768w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-350x63.jpg 350w, https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo-500x90.jpg 500w" data-src="https://cdn.cyberpunk.rs/wp-content/uploads/2020/01/autosploit_banner_logo.jpg" data-sizes="(max-width: 1000px) 100vw, 1000px" /></figure>
<h2>Autosploit: Advanced Remote Host Mass Exploitation</h2>
<p class="text-justify">With this tool, you can easily launch an attack on a remote host within a fairly short time. This is made possible due to the availability of Shodan, a powerful search engine that allows you to automatically fish out targets that are connected to a particular network service. Alternatively, you can also use target seeking tools such as Zoomeye and Censys to search out intended targets.</p>
<p class="text-justify">Apart from the automated host searching and collection, AutoSploit also gives you the option of creating your own customized target list. With this option in place, you can effectively launch attack-intended searches on hosts of your choice by manually adding them to your list.</p>
<h3>Metasploit Modules and How They Work Together</h3>
<div class="alert alert-secondary">The available powerful Metasploit modules are responsible for handling the rest of the work after the targets have been collected. By default, Metasploit comes with a long list of attack modules but you can manually add other modules of your liking to make the tool more powerful. The module deployed will depend on the platform search query that was used when an attack was launched. The Metasploit modules can help a pentester to gain access to services such as Meterpreter sessions and also be able to make remote code executions and many other attacks.</div>
<div class="alert alert-secondary">The combination of Shodan and Metasploit makes it very easy to use autosploit especially since the whole process is automated. The inclusion of Metasploit makes autosploit very effective tool when it comes to launching attacks on Apache-based projects.</div>
<h3>AutoSploit Features:</h3>
<ul>
<li>Automated Target Collection</li>
<li>Customized Target List (allows you to add your own list of targets)</li>
<li>Metasploit Modules</li>
<li>Custom user-agent</li>
<li>Mass exploitations</li>
</ul>
<h3>Supported Platforms:</h3>
<ul>
<li>Linux</li>
<li>OS X (must be within virtual environments to properly function)</li>
</ul>
<h3>Dependencies:</h3>
<p>This tool relies on the below <code>Python 2.7</code> modules:</p>
<ul>
<li>requests</li>
<li>psutil</li>
</ul>
<p>The required dependencies should all be in place after performing an installation with the recommended method, but you can easily install them using <code>pip</code>:</p>
<pre class="wp-block-preformatted">$ pip install -r requirements.txt</pre>
<p>Alternatively:</p>
<pre class="wp-block-preformatted">$ pip install requests psutil</pre>
<h2>Autosploit Install</h2>
<h3>Install AutoSploit via Docker Compose:</h3>
<p>Clone the repo:</p>
<pre class="wp-block-preformatted">$ git clone https://github.com/NullArray/AutoSploit.git</pre>
<p>Navigate to the Autosploit directory and run:</p>
<pre class="wp-block-preformatted">$ cd Autosploit/Docker
$ docker-compose run --rm autosploit</pre>
<h3>Install AutoSploit on Linux (via cloning)</h3>
<p>Clone:</p>
<pre class="wp-block-preformatted">$ git clone https://github.com/NullArray/AutoSploit</pre>
<p>Navigate to the AutoSploit directory, make the install script executable and install:</p>
<pre class="wp-block-preformatted">$ cd AutoSploit
$ chmod +x install.sh
$ ./install.sh</pre>
<h2>Usage</h2>
<p>To start AutoSploit run:</p>
<pre class="wp-block-preformatted">$ python autosploit.py</pre>
<p>This will take you to the available user options that you can choose from.</p>
<pre class="wp-block-preformatted">usage: python autosploit.py -[c|z|s|a] -[q] QUERY
                            [-C] WORKSPACE LHOST LPORT [-e] [--whitewash] PATH
                            [--ruby-exec] [--msf-path] PATH [-E] EXPLOIT-FILE-PATH
                            [--rand-agent] [--proxy] PROTO://IP:PORT [-P] AGENT

optional arguments:
  -h, --help            show this help message and exit

search engines:
  possible search engines to use

  -c, --censys          use censys.io as the search engine to gather hosts
  -z, --zoomeye         use zoomeye.org as the search engine to gather hosts
  -s, --shodan          use shodan.io as the search engine to gather hosts
  -a, --all             search all available search engines to gather hosts

requests:
  arguments to edit your requests

  --proxy PROTO://IP:PORT
                        run behind a proxy while performing the searches
  --random-agent        use a random HTTP User-Agent header
  -P USER-AGENT, --personal-agent USER-AGENT
                        pass a personal User-Agent to use for HTTP requests
  -q QUERY, --query QUERY
                        pass your search query

exploits:
  arguments to edit your exploits

  -E PATH, --exploit-file PATH
                        provide a text file to convert into JSON and save for
                        later use
  -C WORKSPACE LHOST LPORT, --config WORKSPACE LHOST LPORT
                        set the configuration for MSF (IE -C default 127.0.0.1
                        8080)
  -e, --exploit         start exploiting the already gathered hosts

misc arguments:
  arguments that don't fit anywhere else

  --ruby-exec           if you need to run the Ruby executable with MSF use
                        this
  --msf-path MSF-PATH   pass the path to your framework if it is not in your
                        ENV PATH
  --whitelist PATH      only exploit hosts listed in the whitelist file</pre>
<div class="row justify-content-center mb-3">
<div class="col-lg-4"><a href="https://github.com/NullArray/AutoSploit/wiki">Documentation</a></div>
<div><a href="https://github.com/NullArray/AutoSploit">Download</a></div>
</div>
<div class="row justify-content-center mb-3">
<div class="col-lg-4"></div>
</div>
<p>The post <a href="http://kostacipo.stream/autosploit-automated-mass-exploiter/">AutoSploit: Automated Mass Exploiter</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/autosploit-automated-mass-exploiter/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HardCIDR – Network CIDR and Range Discovery Tool</title>
		<link>http://kostacipo.stream/hardcidr-network-cidr-and-range-discovery-tool/</link>
					<comments>http://kostacipo.stream/hardcidr-network-cidr-and-range-discovery-tool/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Sun, 02 Jun 2024 21:50:19 +0000</pubDate>
				<category><![CDATA[Exploitation Tools]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[Network CIDR]]></category>
		<category><![CDATA[Range Discovery Tool]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2210</guid>

					<description><![CDATA[<p>hardCIDR Background A Linux Bash script to discover the netblocks, or ranges, (in CIDR notation) owned by the target organization during the intelligence gathering phase of a penetration test. This information is maintained by the five Regional Internet Registries (RIRs): ARIN (North America) RIPE (Europe/Asia/Middle East) APNIC (Asia/Pacific) LACNIC (Latin America) AfriNIC (Africa) In addition [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/hardcidr-network-cidr-and-range-discovery-tool/">HardCIDR – Network CIDR and Range Discovery Tool</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">hardCIDR</h1>
</div>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Background</h2>
</div>
<p dir="auto">A Linux Bash script to discover the netblocks, or ranges, (in CIDR notation) owned by the target organization during the intelligence gathering phase of a penetration test. This information is maintained by the five Regional Internet Registries (RIRs):</p>
<p dir="auto"><em>ARIN</em> (North America)<br />
<em>RIPE</em> (Europe/Asia/Middle East)<br />
<em>APNIC</em> (Asia/Pacific)<br />
<em>LACNIC</em> (Latin America)<br />
<em>AfriNIC</em> (Africa)</p>
<p dir="auto">In addition to netblocks and IP addresses, Autonomous System Numbers (ASNs) are also of interest. ASNs are used as part of the Border Gateway Protocol (BGP) for uniquely identifying each network on the Internet. Target organizations may have their own ASNs due to the size of their network or as a result of redundant service paths from peered service providers. These ASNs will reveal additional netblocks owned by the organization.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Requirements</h2>
</div>
<p dir="auto">ipcalc (for RIPE, APNIC, LACNIC, AfriNIC queries)</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">LACNIC</h2>
</div>
<p dir="auto">A note on LACNIC before diving into the usage. LACNIC only allows query of either network range, ASN, Org Handle, or PoC Handle. This does not help us in locating these values based upon the organization name. They do however publish a list of all assigned ranges on a publically accessible FTP server, along with their rate-limiting thresholds. So, there is an accompanying data file, which the script checks for, used to perform LACNIC queries locally. The script includes an update option <strong>-r</strong>, that can be used to update this data on an interval of your choosing. Approximate run time is just shy of 28 hours.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Usage</h2>
</div>
<p dir="auto">The script with no specified options will query ARIN and a pool of BGP route servers. The route server is selected at random at runtime. The <strong>-h</strong> option lists the help:</p>
<p dir="auto"><a href="https://camo.githubusercontent.com/33d13d755adc7bf86d0a6304ba7272e98a4ce9d68016300ebbd605afaf124ca2/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67312e706e67" target="_blank" rel="noopener noreferrer nofollow"><img decoding="async" src="https://camo.githubusercontent.com/33d13d755adc7bf86d0a6304ba7272e98a4ce9d68016300ebbd605afaf124ca2/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67312e706e67" alt="" data-canonical-src="https://www.trustedsec.com/wp-content/uploads/2017/03/img1.png" /></a></p>
<p dir="auto">The options may be used in any combination, all, or none. Unfortunately, none of the “other” RIRs note the actual CIDR notation of the range, so <code>ipcalc</code> is used to perform this function. If it is not installed on your system, the script will install it for you.</p>
<p dir="auto">At the prompts, enter the organization name, the email domain, and whether country codes are used as part of the email. If answered <strong>Y</strong> to country codes, you will be prompted as to whether they precede the domain name or are appended to the TLD. A directory will be created for the output files in /tmp/. If the directory is found to exist, you will be prompted whether to overwrite. If answered <strong>N</strong>, a time stamp will be appended to the directory name.</p>
<p dir="auto"><a href="https://camo.githubusercontent.com/8ddd1a77d8860117f3be417056d9855cd09a26c1e6e62d0059bead7a329aa583/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67322e706e67" target="_blank" rel="noopener noreferrer nofollow"><img decoding="async" src="https://camo.githubusercontent.com/8ddd1a77d8860117f3be417056d9855cd09a26c1e6e62d0059bead7a329aa583/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67322e706e67" alt="" data-canonical-src="https://www.trustedsec.com/wp-content/uploads/2017/03/img2.png" /></a></p>
<p dir="auto">The script queries each RIR, as well as a BGP route server, prompting along the way as to whether records were located. Upon completion, three files will be generated: a CSV based on Org Handle, a CSV based on PoC Handle, and a line delimited file of all located raanges in CIDR notation.</p>
<p dir="auto"><a href="https://camo.githubusercontent.com/d0b5b2b09ee476dc980ff7b63a33b578f225db2c9076c54b3fe3c9fb64d41a74/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67332e706e67" target="_blank" rel="noopener noreferrer nofollow"><img decoding="async" src="https://camo.githubusercontent.com/d0b5b2b09ee476dc980ff7b63a33b578f225db2c9076c54b3fe3c9fb64d41a74/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67332e706e67" alt="" data-canonical-src="https://www.trustedsec.com/wp-content/uploads/2017/03/img3.png" /></a></p>
<p dir="auto">Cancelling the script at any time will remove any temporary working files and the directory created for the resultant output files.</p>
<p dir="auto"><a href="https://camo.githubusercontent.com/e7a2ec184f748d383fb88d2c946419f768f34eafaa992fcd1c49ecfba269b40e/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67342e706e67" target="_blank" rel="noopener noreferrer nofollow"><img decoding="async" src="https://camo.githubusercontent.com/e7a2ec184f748d383fb88d2c946419f768f34eafaa992fcd1c49ecfba269b40e/68747470733a2f2f7777772e747275737465647365632e636f6d2f77702d636f6e74656e742f75706c6f6164732f323031372f30332f696d67342e706e67" alt="" data-canonical-src="https://www.trustedsec.com/wp-content/uploads/2017/03/img4.png" /></a></p>
<p dir="auto">It should be noted that, due to similarity in some organization names, you could get back results not related to the target. The CSV files will provide the associated handles and URLs for further validation where necessary. It is also possible that employees of the target organization used their corporate email address to register their own domains. These will be found within the results as well.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Running with Docker</h2>
</div>
<pre class="notranslate"><code>docker build -t hardcidr .
</code></pre>
<p dir="auto">Building the hardcidr image</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>docker run -v $(pwd):/tmp -it hardcidr
</code></pre>
</div>
<p>Running the container. Output will be saved to current directory</p>
<p>The post <a href="http://kostacipo.stream/hardcidr-network-cidr-and-range-discovery-tool/">HardCIDR – Network CIDR and Range Discovery Tool</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/hardcidr-network-cidr-and-range-discovery-tool/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>DataSurgeon – Extract Sensitive Information (PII) From Logs</title>
		<link>http://kostacipo.stream/datasurgeon-extract-sensitive-information-pii-from-logs/</link>
					<comments>http://kostacipo.stream/datasurgeon-extract-sensitive-information-pii-from-logs/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Sun, 02 Jun 2024 21:44:07 +0000</pubDate>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[Exploitation Tools]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[extracting information]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2207</guid>

					<description><![CDATA[<p>DataSurgeon (ds) is a versatile tool designed for incident response, DLP, penetration testing, and CTF challenges. It allows for the extraction of various types of sensitive information including emails, phone numbers, hashes, credit cards, URLs, IP addresses, MAC addresses, SRV DNS records and a lot more! Supports Windows, Linux and MacOS Support recursive file analysis [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/datasurgeon-extract-sensitive-information-pii-from-logs/">DataSurgeon – Extract Sensitive Information (PII) From Logs</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p dir="auto">DataSurgeon (ds) is a versatile tool designed for incident response, DLP, penetration testing, and CTF challenges. It allows for the extraction of various types of sensitive information including emails, phone numbers, hashes, credit cards, URLs, IP addresses, MAC addresses, SRV DNS records and a lot more!</p>
<ul dir="auto">
<li>Supports Windows, Linux and MacOS</li>
<li>Support recursive file analysis within directories</li>
<li>Plugin Support</li>
<li>CSV Output</li>
</ul>
<h2 class="wp-block-heading">DataSurgeon – Extract Sensitive Information (PII) From Logs Features</h2>
<p>DataSurgeon is able to extract:</p>
<ul>
<li>Emails</li>
<li>Files</li>
<li>Phone numbers</li>
<li>Credit Cards</li>
<li>Google API Private Key ID’s</li>
<li>Social Security Numbers</li>
<li>AWS Keys</li>
<li>Bitcoin wallets</li>
<li>URL’s</li>
<li>IPv4 Addresses and IPv6 addresses</li>
<li>MAC Addresses</li>
<li>SRV DNS Records</li>
<li>Extract Hashes
<ul>
<li>MD4 &amp; MD5</li>
<li>SHA-1, SHA-224, SHA-256, SHA-384, SHA-512</li>
<li>SHA-3 224, SHA-3 256, SHA-3 384, SHA-3 512</li>
<li>MySQL 323, MySQL 41</li>
<li>NTLM</li>
<li>bcrypt</li>
</ul>
</li>
</ul>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Extraction Features</h1>
</div>
<p dir="auto">To learn how to manage plugins please follow the guide <a href="https://github.com/Drew-Alleman/DataSurgeon?tab=readme-ov-file#managing-plugins">here</a>.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Personal Information</h2>
</div>
<ul dir="auto">
<li>Emails</li>
<li>Phone numbers</li>
<li>Social Security Numbers</li>
</ul>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Financial Information</h2>
</div>
<ul dir="auto">
<li>Credit Cards</li>
<li>Bitcoin wallets</li>
</ul>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Network Information</h2>
</div>
<ul dir="auto">
<li>URL&#8217;s</li>
<li>IPv4 Addresses and IPv6 addresses</li>
<li>MAC Addresses</li>
<li>SRV DNS Records</li>
</ul>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Security Information</h2>
</div>
<ul dir="auto">
<li>Google API Private Key ID&#8217;s</li>
<li>AWS Keys</li>
<li><a href="https://github.com/DataSurgeon-ds/ds-cve-plugin/">CVE Numbers</a> (PLUGIN)</li>
</ul>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">System and File Information</h2>
</div>
<ul dir="auto">
<li>Files</li>
<li><a href="https://github.com/Drew-Alleman/ds-winreg-plugin/">Windows Registries</a> (PLUGIN)</li>
</ul>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Hashes</h2>
</div>
<ul dir="auto">
<li>MD4 &amp; MD5</li>
<li>SHA-1, SHA-224, SHA-256, SHA-384, SHA-512</li>
<li>SHA-3 224, SHA-3 256, SHA-3 384, SHA-3 512</li>
<li>MySQL 323, MySQL 41</li>
<li>NTLM</li>
<li>bcrypt</li>
</ul>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Quick Install</h1>
</div>
<p dir="auto">The quick installer can also be used to update DataSurgeon.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Video Guide</h2>
</div>
<p dir="auto"><a href="https://www.youtube.com/watch?v=_Sq8Qgndi4M" rel="nofollow"><img decoding="async" src="https://camo.githubusercontent.com/5d1c80aff1e766a49889ca499e93528c5faa816c581d7f098d67c01b9bf85b98/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f5f53713851676e6469344d2f302e6a7067" alt="Guide" data-canonical-src="https://img.youtube.com/vi/_Sq8Qgndi4M/0.jpg" /></a></p>
<p dir="auto">Install <a href="https://www.rust-lang.org/tools/install" rel="nofollow">Rust</a> and <a href="https://git-scm.com/downloads" rel="nofollow">Github</a> then RESTART YOUR TERMINAL.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Linux</h3>
</div>
<pre class="notranslate"><code>read -p "Would you like to add 'ds' to your local bin? This will make 'ds' executable from any location in your terminal. (y/n) " response &amp;&amp; wget -q -O - https://raw.githubusercontent.com/Drew-Alleman/DataSurgeon/main/install/install.sh | bash -s -- "$response"</code></pre>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Windows</h3>
</div>
<p dir="auto">Enter the line below in an elevated powershell window.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>IEX (New-Object Net.WebClient).DownloadString("https://raw.githubusercontent.com/Drew-Alleman/DataSurgeon/main/install/install.ps1")
</code></pre>
</div>
<p dir="auto">Relaunch your terminal and you will be able to use <code>ds</code> from the command line.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Mac</h3>
</div>
<pre class="notranslate"><code>curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/Drew-Alleman/DataSurgeon/main/install/install.sh | sh
</code></pre>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Command Line Arguments</h1>
<p><a id="user-content-command-line-arguments" class="anchor" href="https://github.com/Drew-Alleman/DataSurgeon?tab=readme-ov-file#command-line-arguments" aria-label="Permalink: Command Line Arguments"></a></div>
<p dir="auto"><a href="https://github.com/Drew-Alleman/DataSurgeon/blob/main/media/help_preview.PNG" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/Drew-Alleman/DataSurgeon/raw/main/media/help_preview.PNG" alt="help" /></a></p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Video Guide</h2>
<p><a id="user-content-video-guide-1" class="anchor" href="https://github.com/Drew-Alleman/DataSurgeon?tab=readme-ov-file#video-guide-1" aria-label="Permalink: Video Guide"></a></div>
<p dir="auto"><a href="https://www.youtube.com/watch?v=LAb6kBOWHwg" rel="nofollow"><img decoding="async" src="https://camo.githubusercontent.com/e40dff9c770486170825e0cfa662c8ab41312ba1f9f2f19a91712e46084ee07b/68747470733a2f2f696d672e796f75747562652e636f6d2f76692f4c4162366b424f574877672f302e6a7067" alt="Video Title" data-canonical-src="https://img.youtube.com/vi/LAb6kBOWHwg/0.jpg" /></a></p>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Examples</h1>
</div>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Extracting Files From a Remote Webiste</h2>
<p><a id="user-content-extracting-files-from-a-remote-webiste" class="anchor" href="https://github.com/Drew-Alleman/DataSurgeon?tab=readme-ov-file#extracting-files-from-a-remote-webiste" aria-label="Permalink: Extracting Files From a Remote Webiste"></a></div>
<p dir="auto">Here I use <code>wget</code> to make a request to stackoverflow then I forward the body text to <code>ds</code> . The <code>-F</code> option will list all files found. <code>--clean</code> is used to remove any extra text that might have been returned (such as extra html). Then the result of is sent to <code>uniq</code> which removes any non unique files found. Ig you wanted you can remove the warning message at the top &#8216;Reading standard input..&#8217; by using -S.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>$ wget -qO - https://www.stackoverflow.com | ds -F --clean | uniq
</code></pre>
</div>
<p dir="auto"><a href="https://github.com/Drew-Alleman/DataSurgeon/blob/main/media/wget_preview.gif" target="_blank" rel="noopener noreferrer" data-target="animated-image.originalLink"><img decoding="async" src="https://github.com/Drew-Alleman/DataSurgeon/raw/main/media/wget_preview.gif" alt="preview" data-target="animated-image.originalImage" /></a></p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Extracting Mac Addresses From an Output File</h2>
<p><a id="user-content-extracting-mac-addresses-from-an-output-file" class="anchor" href="https://github.com/Drew-Alleman/DataSurgeon?tab=readme-ov-file#extracting-mac-addresses-from-an-output-file" aria-label="Permalink: Extracting Mac Addresses From an Output File"></a></div>
<p dir="auto">Here I am pulling all mac addresses found in <a href="https://github.com/Drew-Alleman/autodeauth">autodeauth&#8217;s</a> log file using the <code>-m</code> query. The <code>--hide</code> option will hide the identifer string infront of the results. In this case &#8216;mac_address: &#8216; is hidden from the output. The <code>-T</code> option is used to check the same line multiple times for matches. Normallly when a match is found the tool moves on to the next line rather then checking again.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>$ ./ds -m -T --hide -f /var/log/autodeauth/log     
2023-02-26 00:28:19 - Sending 500 deauth frames to network: BC:2E:48:E5:DE:FF -- PrivateNetwork
2023-02-26 00:35:22 - Sending 500 deauth frames to network: 90:58:51:1C:C9:E1 -- TestNet
</code></pre>
</div>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Reading all files in a directory</h2>
</div>
<p dir="auto">You can use the <code>--directory</code> option to read all files in the specified directory recursively. The <code>-D</code> option is used to display the filename where the match was found. <code>-l</code> or <code>--line</code> is used to display the line number the content was found on.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>$ ds --directory test_dir/ -Dl
</code></pre>
</div>
<p dir="auto"><a href="https://github.com/Drew-Alleman/DataSurgeon/blob/main/media/directory_search.gif" target="_blank" rel="noopener noreferrer" data-target="animated-image.originalLink"><img decoding="async" src="https://github.com/Drew-Alleman/DataSurgeon/raw/main/media/directory_search.gif" alt="preview" data-target="animated-image.originalImage" /></a></p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">CSV Output</h2>
</div>
<p dir="auto">To output your results to a CSV file, use the <code>-o</code> option followed by the name of the file you want to save your data to. The <code>-D</code> and <code>-X</code> are supported. The format is: <code>ds -o &lt;FILENAME&gt;.csv</code> (.csv is needed).</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code> $ wget -qO - https://www.stackoverflow.com | ds -o output.csv -C
</code></pre>
<div class="zeroclipboard-container"></div>
</div>
<p dir="auto"><a href="https://github.com/Drew-Alleman/DataSurgeon/blob/main/media/csv_output.gif" target="_blank" rel="noopener noreferrer" data-target="animated-image.originalLink"><img decoding="async" src="https://github.com/Drew-Alleman/DataSurgeon/raw/main/media/csv_output.gif" alt="preview" data-target="animated-image.originalImage" /></a></p>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Speed Tests</h1>
</div>
<p dir="auto">When no specific query is provided, <code>ds</code> will search through all possible types of data, which is <b>SIGNIFICANTLY</b> slower than using individual queries. The slowest query is <code>--files</code>. Its also slightly faster to use <code>cat</code> to pipe the data to <code>ds</code>.</p>
<p dir="auto">Below is the elapsed time when processing a 5GB test file generated by <a href="https://github.com/Drew-Alleman/ds-test">ds-test</a>. Each test was ran 3 times and the average time was recorded.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Computer Specs</h3>
<p><a id="user-content-computer-specs" class="anchor" href="https://github.com/Drew-Alleman/DataSurgeon?tab=readme-ov-file#computer-specs" aria-label="Permalink: Computer Specs"></a></div>
<pre class="notranslate"><code>Processor	Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz, 2904 Mhz, 6 Core(s), 12 Logical Processor(s)
Ram         12.0 GB (11.9 GB usable)
</code></pre>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Searching all data types</h2>
</div>
<table>
<thead>
<tr>
<th>Command</th>
<th>Speed</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>cat test.txt | ds -t</code></td>
<td>00h:02m:04s</td>
</tr>
<tr>
<td><code>ds -t -f test.txt</code></td>
<td>00h:02m:05s</td>
</tr>
<tr>
<td><code>cat test.txt | ds -t -o output.txt</code></td>
<td>00h:02m:06s</td>
</tr>
</tbody>
</table>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Using specific queries</h2>
</div>
<table>
<thead>
<tr>
<th>Command</th>
<th>Speed</th>
<th>Query Count</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>cat test.txt | ds -t -6</code></td>
<td>00h:00m:12s</td>
<td>1</td>
</tr>
<tr>
<td><code>cat test.txt | ds -t -i -m</code></td>
<td>00h:00m:22</td>
<td>2</td>
</tr>
<tr>
<td><code>cat test.txt | ds -tF6c</code></td>
<td>00h:00m:32s</td>
<td>3</td>
</tr>
</tbody>
</table>
<p>The post <a href="http://kostacipo.stream/datasurgeon-extract-sensitive-information-pii-from-logs/">DataSurgeon – Extract Sensitive Information (PII) From Logs</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/datasurgeon-extract-sensitive-information-pii-from-logs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Nmap Analysis Tool – Enhancing Network Security Through Advanced Analysis And Reporting</title>
		<link>http://kostacipo.stream/nmap-analysis-tool-enhancing-network-security-through-advanced-analysis-and-reporting/</link>
					<comments>http://kostacipo.stream/nmap-analysis-tool-enhancing-network-security-through-advanced-analysis-and-reporting/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Sat, 02 Mar 2024 23:20:51 +0000</pubDate>
				<category><![CDATA[Networks]]></category>
		<category><![CDATA[Pentesting]]></category>
		<category><![CDATA[Vulnerability Analysis]]></category>
		<category><![CDATA[network scanning]]></category>
		<category><![CDATA[nmap]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2199</guid>

					<description><![CDATA[<p>This CLI python script is designed to be used by security consultants, IT admins and network engineers to do two things, compare two Nmap XML files to create a spreadsheet that compares IPs, ports and services between the files, and create a markdown report using GPT. Screenshots Features Comprehensive Nmap XML Parsing Multiple File Support: [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/nmap-analysis-tool-enhancing-network-security-through-advanced-analysis-and-reporting/">Nmap Analysis Tool – Enhancing Network Security Through Advanced Analysis And Reporting</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This CLI python script is designed to be used by security consultants, IT admins and network engineers to do two things, compare two Nmap XML files to create a spreadsheet that compares IPs, ports and services between the files, and create a markdown report using GPT.</p>
<h2 class="wp-block-heading"><strong>Screenshots</strong></h2>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" class="td-animation-stack-type0-2" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEii1617EgqwB2SASox3fLQJDoakjvbCcOefh_DIYSeCoflLm0bksvrBM-JHq7BP-bYb0H7q3YUksyNwGwRtaSuWvVOsCxTKlTwyj2pq9eUt0zPsBligrQFTK9KZQUS88cKSEzi9U3q2Ko7b9KYYQytpa8lpUO_xn85MT5TE6F2D095i5bAeNSFTVGAAZxXA/s16000/spreadsheet.webp" alt="" /></figure>
</div>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" class="td-animation-stack-type0-2" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBpEqzLvVb3-s7FA3sEkKn4SV84ocKoAadE9xBAzsWpgWic2lb-rRPB7dmgr4cbFP2E0mB4oFR2wdGOLYZ_xZtUzPaCjNCx4vq1mbYnzO7A_pUxsQCHbv4F_1s14UJISxgYoOQbYcXJ84UbeXNF97CVlR4nd7puNigFUNgW4jNTEtfqwfvEhkTiVEbTBTs/s16000/spreadsheet-pie.webp" alt="" /></figure>
</div>
<div class="wp-block-image">
<figure class="aligncenter size-large"><img decoding="async" class="td-animation-stack-type0-2" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnEKSKqDEN-YewRZALmeBMhFkLNiHcn5PRC5yFlgdlLiihsNZBV7D7AURn-ErjVHqH-_Of2Hu4T4abP9kEHblP-9dE0sNneb0Xv9G6h2qDIT7pQuLgkVf8OSWC6-lJPJ2PhMXuFpvcjj183_yaCZwK37-fmmCKRMqS8S8gD6mEovUpz9mZX_TagWxDhKRL/s16000/gpt-report.webp" alt="" /></figure>
</div>
<h2 class="wp-block-heading"><strong>Features</strong></h2>
<h3 class="wp-block-heading"><strong>Comprehensive Nmap XML Parsing</strong></h3>
<ul>
<li><strong>Multiple File Support</strong>: Parse and analyze two Nmap XML output files.</li>
<li><strong>Structured Data</strong>: Converts Nmap’s XML output into a structured format for further processing.</li>
</ul>
<h3 class="wp-block-heading"><strong>Comparative Analysis</strong></h3>
<ul>
<li><strong>Change Detection</strong>: Compare results from two Nmap scans to identify new, altered, or removed services and ports. Useful for when you scan the same IPs from different source IPs or over time.</li>
<li><strong>Excel Reporting</strong>: Automatically generates detailed Excel spreadsheets with the comparison results and some stats.</li>
</ul>
<h3 class="wp-block-heading"><strong>Statistical Overview And Visualization</strong></h3>
<ul>
<li><strong>Network Exposure Statistics</strong>: Offers statistical analysis on detected services and open ports.</li>
<li><strong>Excel Visualizations</strong>: Includes pie charts in Excel reports for a graphical representation of the network’s security posture.</li>
</ul>
<h3 class="wp-block-heading"><strong>AI-Powered Insights With GPT</strong></h3>
<ul>
<li><strong>GPT Report Generation</strong>: Uses OpenAI’s GPT to generate insightful analysis reports based on Nmap result stats. The tool uses a hardcoded prompt that sets the tone and requirements, then the script inserts the stats (no identifying information is provided) and if -c –context has been provided, it’ll add the context to the bottom of the prompt.</li>
<li><strong>Customizable Context</strong>: Enhance GPT analysis by providing additional context, tailoring the report to specific needs.</li>
</ul>
<h2 class="wp-block-heading"><strong>Usage</strong></h2>
<p>The script prints the help page if no args are passed, or you can access with <code>python nmap-analysis.py -h</code></p>
<ul>
<li><strong>Comparing Nmap Scans</strong>:</li>
</ul>
<pre class="wp-block-code"><code>python nmap-analysis.py compare -ff (--first-nmap-file) path/to/first.xml -lf (--last-nmap-file) path/to/second.xml</code></pre>
<ul>
<li><strong>Generating a GPT Report</strong>:</li>
</ul>
<pre class="wp-block-code"><code>python nmap-analysis.py gpt-report -gf (--gpt-nmap-file) path/to/nmap.xml -c (--context) "Your optional context here"</code></pre>
<h2 class="wp-block-heading"><strong>Installation and Setup</strong></h2>
<h3 class="wp-block-heading"><strong>Prerequisites</strong></h3>
<ul>
<li>3.10+ probably (created using 3.12)</li>
<li>An OpenAI API key for GPT report generation that is set in local env</li>
</ul>
<h3 class="wp-block-heading"><strong>Secure Installation with <code>venv</code></strong></h3>
<ol>
<li><strong>Clone the Repository</strong>:</li>
</ol>
<pre class="wp-block-code"><code>git clone <a href="https://github.com/FlyingPhish/Nmap-Analysis.git">https://github.com/FlyingPhish/Nmap-Analysis</a>
cd nmap-analysis-tool</code></pre>
<p>2. <strong>Create a Virtual Environment</strong>:</p>
<pre class="wp-block-code"><code>python3 -m venv venv</code></pre>
<ol start="3">
<li><strong>Activate the Virtual Environment</strong>:</li>
</ol>
<ul>
<li>On Windows:</li>
</ul>
<pre class="wp-block-code"><code>.\venv\Scripts\activate</code></pre>
<p>The post <a href="http://kostacipo.stream/nmap-analysis-tool-enhancing-network-security-through-advanced-analysis-and-reporting/">Nmap Analysis Tool – Enhancing Network Security Through Advanced Analysis And Reporting</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/nmap-analysis-tool-enhancing-network-security-through-advanced-analysis-and-reporting/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>NTLM Relay Gat – Automating Exploitation Of NTLM Relay Vulnerabilities</title>
		<link>http://kostacipo.stream/ntlm-relay-gat-automating-exploitation-of-ntlm-relay-vulnerabilities/</link>
					<comments>http://kostacipo.stream/ntlm-relay-gat-automating-exploitation-of-ntlm-relay-vulnerabilities/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Sat, 02 Mar 2024 23:16:38 +0000</pubDate>
				<category><![CDATA[Exploitation Tools]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[ntlm]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2196</guid>

					<description><![CDATA[<p>NTLM Relay Gat revolutionizes the approach to exploiting NTLM relay vulnerabilities by automating the use of the Impacket suite’s ntlmrelayx.py tool. Designed for both novices and experienced cybersecurity professionals, this tool streamlines the process of identifying and exploiting weaknesses in network security. With its user-friendly interface and powerful features, NTLM Relay Gat serves as a [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/ntlm-relay-gat-automating-exploitation-of-ntlm-relay-vulnerabilities/">NTLM Relay Gat – Automating Exploitation Of NTLM Relay Vulnerabilities</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>NTLM Relay Gat revolutionizes the approach to exploiting NTLM relay vulnerabilities by automating the use of the Impacket suite’s ntlmrelayx.py tool.</p>
<p>Designed for both novices and experienced cybersecurity professionals, this tool streamlines the process of identifying and exploiting weaknesses in network security.</p>
<p>With its user-friendly interface and powerful features, NTLM Relay Gat serves as a critical asset in the toolkit of ethical hackers and penetration testers aiming to enhance their network defense strategies.</p>
<h2 class="wp-block-heading"><strong>Description</strong></h2>
<p>NTLM Relay Gat is a powerful tool designed to automate the exploitation of NTLM relays using <code>ntlmrelayx.py</code> from the Impacket tool suite. By leveraging the capabilities of <code>ntlmrelayx.py</code>, NTLM Relay Gat streamlines the process of exploiting NTLM relay vulnerabilities, offering a range of functionalities from listing SMB shares to executing commands on MSSQL databases.</p>
<h2 class="wp-block-heading"><strong>Features</strong></h2>
<ul>
<li><strong>Multi-threading Support</strong>: Utilize multiple threads to perform actions concurrently.</li>
<li><strong>SMB Shares Enumeration</strong>: List available SMB shares.</li>
<li><strong>SMB Shell Execution</strong>: Execute a shell via SMB.</li>
<li><strong>Secrets Dumping</strong>: Dump secrets from the target.</li>
<li><strong>MSSQL Database Enumeration</strong>: List available MSSQL databases.</li>
<li><strong>MSSQL Command Execution</strong>: Execute operating system commands via xp_cmdshell or start SQL Server Agent jobs.</li>
</ul>
<h2 class="wp-block-heading"><strong>Prerequisites</strong></h2>
<p>Before you begin, ensure you have met the following requirements:</p>
<ul>
<li><code>proxychains</code> properly configured with ntlmrelayx SOCKS relay port</li>
<li>Python 3.6+</li>
</ul>
<h2 class="wp-block-heading"><strong>Installation</strong></h2>
<p>To install NTLM Relay Gat, follow these steps:</p>
<ol>
<li>Ensure that Python 3.6 or higher is installed on your system.</li>
<li>Clone NTLM Relay Gat repository:</li>
</ol>
<pre class="wp-block-code"><code>git clone https://github.com/ad0nis/ntlm_relay_gat.git
cd ntlm_relay_gat</code></pre>
<p>Install dependencies, if you don’t have them installed already:</p>
<pre class="wp-block-code"><code>pip install -r requirements.txt</code></pre>
<p>NTLM Relay Gat is now installed and ready to use.</p>
<h2 class="wp-block-heading"><strong>Usage</strong></h2>
<p>To use NTLM Relay Gat, make sure you’ve got relayed sessions in <code>ntlmrelayx.py</code>‘s <code>socks</code> command output and that you have proxychains configured to use <code>ntlmrelayx.py</code>‘s proxy, and then execute the script with the desired options. Here are some examples of how to run NTLM Relay Gat:</p>
<pre class="wp-block-code"><code># List available SMB shares using 10 threads
python ntlm_relay_gat.py --smb-shares -t 10

# Execute a shell via SMB
python ntlm_relay_gat.py --smb-shell --shell-path /path/to/shell

# Dump secrets from the target
python ntlm_relay_gat.py --dump-secrets

# List available MSSQL databases
python ntlm_relay_gat.py --mssql-dbs

# Execute an operating system command via xp_cmdshell
python ntlm_relay_gat.py --mssql-exec --mssql-method 1 --mssql-command 'whoami'</code></pre>
<p>The post <a href="http://kostacipo.stream/ntlm-relay-gat-automating-exploitation-of-ntlm-relay-vulnerabilities/">NTLM Relay Gat – Automating Exploitation Of NTLM Relay Vulnerabilities</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/ntlm-relay-gat-automating-exploitation-of-ntlm-relay-vulnerabilities/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Abusing Family Refresh Tokens For Unauthorized Access And Persistence In Azure Active Directory</title>
		<link>http://kostacipo.stream/abusing-family-refresh-tokens-for-unauthorized-access-and-persistence-in-azure-active-directory/</link>
					<comments>http://kostacipo.stream/abusing-family-refresh-tokens-for-unauthorized-access-and-persistence-in-azure-active-directory/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Sat, 02 Mar 2024 21:24:57 +0000</pubDate>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Cybersecurity]]></category>
		<category><![CDATA[Exploitation Tools]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Azure Active Directory]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2190</guid>

					<description><![CDATA[<p>Abusing Family Refresh Tokens for Unauthorized Access and Persistence in Azure Active Directory Ryan Marcotte Cobb, CTU Special Operations Tony Gore, CTU Special Operations Undocumented functionality in Azure Active Directory allows a group of Microsoft OAuth client applications to obtain special “family refresh tokens,” which can be redeemed for bearer tokens as any other client [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/abusing-family-refresh-tokens-for-unauthorized-access-and-persistence-in-azure-active-directory/">Abusing Family Refresh Tokens For Unauthorized Access And Persistence In Azure Active Directory</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div class="markdown-heading" dir="auto">
<h1 dir="auto" tabindex="-1"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-2194" src="https://kostacipo.stream/wp-content/uploads/2024/03/Screenshot-2024-03-02-221723.png" alt="" width="858" height="255" srcset="https://kostacipo.stream/wp-content/uploads/2024/03/Screenshot-2024-03-02-221723.png 858w, https://kostacipo.stream/wp-content/uploads/2024/03/Screenshot-2024-03-02-221723-300x89.png 300w, https://kostacipo.stream/wp-content/uploads/2024/03/Screenshot-2024-03-02-221723-768x228.png 768w" sizes="(max-width: 858px) 100vw, 858px" /></h1>
<h1 class="heading-element" dir="auto" tabindex="-1">Abusing Family Refresh Tokens for Unauthorized Access and Persistence in Azure Active Directory</h1>
</div>
<ul dir="auto">
<li>Ryan Marcotte Cobb, CTU Special Operations</li>
<li>Tony Gore, CTU Special Operations</li>
</ul>
<p dir="auto">Undocumented functionality in Azure Active Directory allows a group of Microsoft OAuth client applications to obtain special “family refresh tokens,” which can be redeemed for bearer tokens as any other client in the family. We will discuss how this functionality was uncovered, the mechanism behind it, and various attack paths to obtain family refresh tokens. We will demonstrate how this functionality can be abused to access sensitive data. Lastly, we will share relevant information to mitigate the theft of family refresh tokens.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Updates</h2>
</div>
<ul dir="auto">
<li>2022-03-23: Added 17 new FOCI family client apps to <code>known-foci-clients.csv</code></li>
</ul>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Table of Contents</h2>
</div>
<ul dir="auto">
<li>Part 1 &#8211; Azure Active Directory and OAuth 2.0</li>
<li>Part 2 &#8211; Introducing Family of Client IDs &amp; Family Refresh Tokens</li>
<li>Part 3 &#8211; Attack Paths</li>
<li>Part 4 &#8211; Mitigations against Family Refresh Tokens</li>
<li>Conclusion</li>
</ul>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Part 1 &#8211; Azure Active Directory and OAuth 2.0</h1>
<p><a id="user-content-part-1---azure-active-directory-and-oauth-20" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#part-1---azure-active-directory-and-oauth-20" aria-label="Permalink: Part 1 - Azure Active Directory and OAuth 2.0"></a></div>
<p dir="auto">Azure Active Directory (Azure AD) is a cloud-based identity and access management (IAM) platform developed by Microsoft. Microsoft uses Azure AD as the IAM provider for its own cloud services, such as Microsoft 365 and Azure Resource Manager. Azure AD implements the <a href="https://www.oauth.com/" rel="nofollow">OAuth 2.0</a> and <a href="https://openid.net/connect/" rel="nofollow">OpenID Connect</a> (OIDC) standards as the foundation for its authorization and authentication functionality, respectively. OAuth 2.0 is an authorization framework that lets resource owners (usually end-users) delegate permissions to client applications to access web services on their behalf. The IETF standard for OAuth 2.0 was originally defined in <a href="https://datatracker.ietf.org/doc/html/rfc6749" rel="nofollow">RFC 6749</a>. Additional technical specifications were later ratified to detail use-cases that were not addressed in RFC 6749. Even with active development on the OAuth 2.0 standard, Microsoft pushes the boundaries of its design to support the sheer scale and variety of services that rely on Azure AD.</p>
<p dir="auto">This research focuses on the OAuth 2.0 implementation in Azure AD. We will highlight a few important differences between the implementation in Azure AD and the OAuth 2.0 specification. We will explore the security implications of these differences and demonstrate how an attacker can abuse Azure AD implementation quirks for privilege escalation and persistent access to Microsoft cloud resources. Lastly, we will share how we weaponized this undocumented feature for red team operations at Secureworks, as well as a few mitigations to protect your organization against it.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Granting Consent</h2>
<p><a id="user-content-granting-consent" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#granting-consent" aria-label="Permalink: Granting Consent"></a></div>
<p dir="auto"><a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/images/consent.svg" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/dirkjanm/family-of-client-ids-research/raw/main/images/consent.svg" alt="consent" /></a></p>
<p dir="auto">The OAuth 2.0 protocol typically involves four participants:</p>
<p dir="auto">The resource server (RS) is a web service that protects information or capabilities belonging to a resource owner (RO). The resource owner usually represents an end-user. The resource server should only allow the authorized delegates of the resource owner to access the protected resources. The resource server may categorize different kinds of protected resources into <a href="https://datatracker.ietf.org/doc/html/rfc6749#section-3.3" rel="nofollow">scopes</a>. Scopes are granular permissions on the resource server that the resource owner can delegate to client applications (CA).</p>
<p dir="auto">The resource owner can allow client applications to have limited access to resource servers by explicitly granting consent to specific scopes. Both the resource server and the resource owner trust the authorization server (AS). The authorization server is responsible for keeping track of the scopes on the resource server that the resource owner granted to the client application.</p>
<p dir="auto">Microsoft 365 is a suite of productivity software-as-a-service solutions, and it uses Azure AD as its IAM provider. Microsoft 365 apps are deeply integrated through a complex web of service dependencies between OAuth applications. Each solution is instantiated as one (or more) OAuth client applications, resource servers, or both in the Azure AD tenant. Many of these Microsoft “first-party” OAuth applications are automatically provisioned in tenant with each deployment of Microsoft 365.</p>
<p dir="auto">To ensure these dependencies are met, many first-party applications are granted (what Microsoft describes as) “implied consent”, sometimes called “pre-consent” or “pre-authorization”. Microsoft wants to hide this complexity, so first-party client applications and their pre-consented scopes are invisible to users and administrators. Our research focused on these first-party client applications and the sensitive scopes that were “pre-authorized” for them on behalf of all users.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Grant Flows</h2>
<p><a id="user-content-grant-flows" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#grant-flows" aria-label="Permalink: Grant Flows"></a></div>
<p dir="auto">When the resource server receives a web request from a client application, it needs to confirm that the client application has consent and authorization by the resource owner to access the requested resources. As previously stated, the authorization server is responsible for keeping track of what the resource owner delegated to the client application. Therefore, the resource server needs some form of proof from the authorization server that the client application is authorized for what it is requesting.</p>
<p dir="auto">The OAuth 2.0 specifications define a variety of protocols &#8211; called grant flows &#8211; involving an authorization server, client application, and (usually) the resource owner. All grant flows result in the authorization server issuing temporary credentials – called <a href="https://datatracker.ietf.org/doc/html/rfc6750" rel="nofollow">bearer tokens</a> – to the client application that will grant access when presented to the resource server. All bearer tokens are issued to the client application by the authorization server.</p>
<p dir="auto">Here is a simplified diagram of the <a href="https://datatracker.ietf.org/doc/html/rfc6749#section-4.1" rel="nofollow">authentication code grant flow</a>:</p>
<p dir="auto"><a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/images/obtains-tokens.svg" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/dirkjanm/family-of-client-ids-research/raw/main/images/obtains-tokens.svg" alt="flows" /></a></p>
<p dir="auto">Although technically outside of the OAuth 2.0 spec, authorization grant flows typically involve an authentication step (defined in a different protocol, such as OpenID Connect) wherein the resource owner proves their identity to the authentication server. Proof of identity usually requires a password or certificate in addition to other authentication challenges, like multi-factor authentication.</p>
<p dir="auto">Some grant flows require proof of identity for the user, while others require proof of identity for the application itself. Client applications that have their own passwords or certificates are called &#8220;confidential&#8221; clients, while clients that do not need their own proof of identity are called &#8220;public&#8221; clients. It is important to note that an attacker can masquerade as the public client application when requesting tokens from the authorization server. Since public clients do not have their own credentials, the authentication server has no way to prove that the authorization grant originates from the legitimate application.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 0 &#8211; Install Dependencies</h3>
<p><a id="user-content-example-0---install-dependencies" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#example-0---install-dependencies" aria-label="Permalink: Example 0 - Install Dependencies"></a></div>
<blockquote>
<p dir="auto">The examples in this notebook require the <a href="https://msal-python.readthedocs.io/en/latest/" rel="nofollow"><code>msal</code></a> and <a href="https://pyjwt.readthedocs.io/en/stable/" rel="nofollow"><code>pyjwt</code></a> packages. If not already installed, we can pip install them in the current kernel by uncommenting and running the cell below. After the packages have been installed, we need to restart your kernel before proceeding with the rest of the notebook.</p>
</blockquote>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto">
<pre><span class="pl-c">#!pip install -r requirements.txt</span>

<span class="pl-k">import</span> <span class="pl-s1">msal</span>
<span class="pl-k">import</span> <span class="pl-s1">requests</span>
<span class="pl-k">import</span> <span class="pl-s1">jwt</span>
<span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-s1">pd</span>.<span class="pl-s1">options</span>.<span class="pl-s1">display</span>.<span class="pl-s1">max_rows</span> <span class="pl-c1">=</span> <span class="pl-c1">999</span>

<span class="pl-k">from</span> <span class="pl-s1">pprint</span> <span class="pl-k">import</span> <span class="pl-s1">pprint</span>
<span class="pl-k">from</span> <span class="pl-s1">typing</span> <span class="pl-k">import</span> <span class="pl-v">Any</span>, <span class="pl-v">Dict</span>, <span class="pl-v">List</span></pre>
<div class="zeroclipboard-container"></div>
</div>
<p dir="auto">Let&#8217;s authorize a Microsoft public client application using Python. In this example, we will complete an device authorization grant flow as the Azure CLI public client application (Client ID: <code>04b07795-8ddb-461a-bbee-02f9e1bf7b46</code>). Since the Azure CLI is a public client, it does not have its own secrets and Azure AD cannot verify whether the authorization request originates from the legitimate commandline tool or an attacker. We will request bearer tokens authorized for the <code>.default</code> scope on the modern Microsoft Graph. Note that <code>msal</code> <a href="https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/dev/msal/application.py#L481">automatically adds</a> the <code>offline_access</code>, <code>profile</code>, and <code>openid</code> scopes to the request. The scope <code>offline_access</code> instructs the Azure AD to return a refresh token in addition to an access token and ID token. We will look closer at these tokens shortly.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 1 &#8211; Device Code Flow</h3>
</div>
<pre><span class="pl-s1">azure_cli_client</span> <span class="pl-c1">=</span> <span class="pl-s1">msal</span>.<span class="pl-v">PublicClientApplication</span>(
    <span class="pl-s">"04b07795-8ddb-461a-bbee-02f9e1bf7b46"</span> <span class="pl-c"># ID for Azure CLI client</span>
)

<span class="pl-s1">device_flow</span> <span class="pl-c1">=</span> <span class="pl-s1">azure_cli_client</span>.<span class="pl-en">initiate_device_flow</span>(
    <span class="pl-s1">scopes</span><span class="pl-c1">=</span>[<span class="pl-s">"https://graph.microsoft.com/.default"</span>]
)

<span class="pl-en">print</span>(<span class="pl-s1">device_flow</span>[<span class="pl-s">"message"</span>])</pre>
<div class="zeroclipboard-container"></div>
<p dir="auto">After the resource owner authenticates and authorizes the grant flow, the client application can acquire bearer tokens from the authorization server.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto">
<pre><span class="pl-s1">azure_cli_bearer_tokens_for_graph_api</span> <span class="pl-c1">=</span> <span class="pl-s1">azure_cli_client</span>.<span class="pl-en">acquire_token_by_device_flow</span>(
    <span class="pl-s1">device_flow</span>
)

<span class="pl-en">pprint</span>(<span class="pl-s1">azure_cli_bearer_tokens_for_graph_api</span>)</pre>
<div class="zeroclipboard-container"></div>
</div>
<p dir="auto">We should now have a set of bearer tokens for the Azure CLI client application.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Bearer Tokens</h2>
<p><a id="user-content-bearer-tokens" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#bearer-tokens" aria-label="Permalink: Bearer Tokens"></a></div>
<p dir="auto">Bearer tokens get their name because <a href="https://datatracker.ietf.org/doc/html/rfc6750#section-1.2" rel="nofollow">“any party in possession of the token (a “bearer”) can use the token in any way that any other party in possession of it can use.”</a> Bearer tokens expire over time, after which the client application will need a new authorization from the resource owner. The <a href="https://datatracker.ietf.org/doc/html/rfc7523" rel="nofollow">standard representation</a> for bearer tokens are <a href="https://jwt.io/introduction" rel="nofollow">JSON Web Tokens</a> (JWT). Azure AD uses three types of bearer tokens: ID tokens, access tokens, and refresh tokens:</p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Standard</th>
<th>Lifetime</th>
</tr>
</thead>
<tbody>
<tr>
<td>ID Token</td>
<td>OIDC</td>
<td>1 Hour</td>
</tr>
<tr>
<td>Access Token</td>
<td>OAuth 2.0</td>
<td>1 hour</td>
</tr>
<tr>
<td>Refresh Token</td>
<td>OAuth 2.0</td>
<td>90 days</td>
</tr>
</tbody>
</table>
<p dir="auto"><strong>ID tokens</strong> contain information about the resource owner, such as their friendly name, user principal name, and location. ID tokens are defined in the OIDC standard and are outside of the scope of this research. We will instead focus on the other two types of tokens.</p>
<p dir="auto"><strong>Access tokens</strong> are the credentials used to access protected resources. Client applications must pass an access token with each web request to the resource server. Access tokens <a href="https://datatracker.ietf.org/doc/html/rfc6749#section-1.4" rel="nofollow">represent specific scopes and durations</a> of access that the resource owner authorized for the client application. Note that access tokens contain <em>claims</em> with information about:</p>
<ul dir="auto">
<li>the provenance of the token (<code>iss</code>)</li>
<li>the resource owner and client application (<code>oid</code>/<code>upn</code>, <code>appid</code>)</li>
<li>the authorized scopes (<code>scp</code>)</li>
<li>the issuance and expiration times (<code>iat</code>, <code>exp</code>)</li>
<li>the resource server (<code>aud</code>)</li>
<li>the authentication methods that the resource owner used to authorize the client application (<code>amr</code>)</li>
<li>and much more</li>
</ul>
<p dir="auto">Let&#8217;s take a closer look at the access token we acquired in the previous example. We will use <code>pyjwt</code> to decode the JSON blob and inspect its contents:</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 2 &#8211; Decode Access Token</h3>
</div>
<pre><span class="pl-k">def</span> <span class="pl-en">decode_jwt</span>(<span class="pl-s1">base64_blob</span>: <span class="pl-s1">str</span>) <span class="pl-c1">-&gt;</span> <span class="pl-v">Dict</span>[<span class="pl-s1">str</span>, <span class="pl-v">Any</span>]:
    <span class="pl-s">"""Decodes base64 encoded JWT blob"""</span>
    <span class="pl-k">return</span> <span class="pl-s1">jwt</span>.<span class="pl-en">decode</span>(
        <span class="pl-s1">base64_blob</span>, <span class="pl-s1">options</span><span class="pl-c1">=</span>{<span class="pl-s">"verify_signature"</span>: <span class="pl-c1">False</span>, <span class="pl-s">"verify_aud"</span>: <span class="pl-c1">False</span>}
    )


<span class="pl-s1">decoded_access_token</span> <span class="pl-c1">=</span> <span class="pl-en">decode_jwt</span>(
    <span class="pl-s1">azure_cli_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"access_token"</span>)
)

<span class="pl-en">pprint</span>(<span class="pl-s1">decoded_access_token</span>)</pre>
<div class="zeroclipboard-container"></div>
<p dir="auto">We can pass the access token in the header of a web request to access the Microsoft Graph as the resource owner. The Graph endpoint <code>/me/oauth2PermissionGrants</code> returns a list of OAuth 2.0 permission grants, which represent consent granted by the user to client applications for specific scopes. The same approach can be used to call any other Graph endpoint &#8211; so long as the access token contains the <a href="https://docs.microsoft.com/en-us/graph/permissions-reference" rel="nofollow">necessary scopes</a>. In the case of <code>/me/oauth2PermissionGrants</code>, access tokens must have a scope containing <code>Directory.Read.All</code>, <code>DelegatedPermissionGrant.ReadWrite.All</code>, <code>Directory.ReadWriteAll</code>, or <code>Directory.AccessAsUser.All</code> to call this API endpoint.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 3 &#8211; Use Access Token to Call Graph API</h3>
</div>
<pre><span class="pl-k">def</span> <span class="pl-en">check_my_oauth2PermissionGrants</span>(<span class="pl-s1">access_token</span>: <span class="pl-s1">str</span>) <span class="pl-c1">-&gt;</span> <span class="pl-v">Dict</span>[<span class="pl-s1">str</span>, <span class="pl-v">Any</span>]:
    <span class="pl-s">"""Lists OAuth2PermissionGrants for the authorized user."""</span>
    <span class="pl-s1">url</span> <span class="pl-c1">=</span> <span class="pl-s">"https://graph.microsoft.com/beta/me/oauth2PermissionGrants"</span>
    <span class="pl-s1">headers</span> <span class="pl-c1">=</span> {
        <span class="pl-s">"Content-Type"</span>: <span class="pl-s">"application/json"</span>,
        <span class="pl-s">"Authorization"</span>: <span class="pl-s">f"Bearer <span class="pl-s1"><span class="pl-kos">{</span>access_token<span class="pl-kos">}</span></span>"</span>,
    }
    <span class="pl-k">return</span> <span class="pl-s1">requests</span>.<span class="pl-en">get</span>(<span class="pl-s1">url</span>, <span class="pl-s1">headers</span><span class="pl-c1">=</span><span class="pl-s1">headers</span>).<span class="pl-en">json</span>()


<span class="pl-en">check_my_oauth2PermissionGrants</span>(
    <span class="pl-s1">azure_cli_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"access_token"</span>)
)</pre>
<div class="zeroclipboard-container"></div>
<blockquote>
<p dir="auto">Note that the Azure CLI client application does not appear in the list of permission grants because it has been &#8220;pre-authorized&#8221; by Microsoft. There are many of these first-party client applications in an Azure AD tenant by default.</p>
</blockquote>
<p dir="auto">Access tokens expire after a short period of time, usually one hour. Once an access token has expired, the client application will need to obtain a new access token to continue accessing protected resources. The client application can either request authorization from the resource owner again or use a refresh token to obtain new access tokens based on the prior authorization.</p>
<p dir="auto"><strong>Refresh tokens</strong> are a special type of bearer token representing the authorization granted by the resource owner to the client application. Client applications can redeem refresh tokens with the authorization server to obtain a new set of bearer tokens (including another refresh token) after the originally issued access token has expired and without requiring new authorization from the resource owner. Refresh tokens are much longer-lived than access tokens; most refresh tokens issued by Azure AD are valid for 90 days. The refresh tokens contain an opaque blob that is encrypted by the authorization server. As such the exact content of refresh tokens is unknown.</p>
<p dir="auto"><a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/images/refresh-tokens.svg" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/dirkjanm/family-of-client-ids-research/raw/main/images/refresh-tokens.svg" alt="refresh" /></a></p>
<p dir="auto">Here is a textbook example of a refresh token grant. We are redeeming the previously obtained refresh token for new bearer tokens bound to the same client and scopes as the original authorization:</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 4 &#8211; Redeem Refresh Token</h3>
</div>
<pre><span class="pl-s1">new_azure_cli_bearer_tokens_for_graph_api</span> <span class="pl-c1">=</span> (

    <span class="pl-c"># Same client as original authorization</span>
    <span class="pl-s1">azure_cli_client</span>.<span class="pl-en">acquire_token_by_refresh_token</span>( 
        <span class="pl-s1">azure_cli_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"refresh_token"</span>),

        <span class="pl-c"># Same scopes as original authorization</span>
        <span class="pl-s1">scopes</span><span class="pl-c1">=</span>[<span class="pl-s">"https://graph.microsoft.com/.default"</span>], 
    )
)

<span class="pl-en">pprint</span>(<span class="pl-s1">new_azure_cli_bearer_tokens_for_graph_api</span>)</pre>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Refresh Tokens: Specification vs. Implementation</h2>
<p><a id="user-content-refresh-tokens-specification-vs-implementation" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#refresh-tokens-specification-vs-implementation" aria-label="Permalink: Refresh Tokens: Specification vs. Implementation"></a></div>
<p dir="auto">Because refresh tokens are long-lived credentials, they are attractive targets for malicious actors. <a href="https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.13.1" rel="nofollow">“If an attacker is able to exfiltrate and successfully replay a refresh token, the attacker will be able to mint access tokens and use them to access resource servers on behalf of the resource owner.”</a> The <a href="https://datatracker.ietf.org/doc/html/rfc6819#section-4.5" rel="nofollow">IETF threat model</a> for OAuth 2.0 elucidates the various ways an attacker could obtain refresh tokens.</p>
<p dir="auto">The OAuth 2.0 specifications include safeguards to mitigate the potential risk from refresh token theft:</p>
<ul dir="auto">
<li>
<p dir="auto">Safeguard #1: <strong>Same Scopes</strong> &#8211; Refresh tokens should only be able <a href="https://datatracker.ietf.org/doc/html/rfc6749#section-1.5" rel="nofollow">“to obtain access tokens with identical or narrower scope”</a> as the original authorization. The most recent guidance from the IETF OAuth working group explains that <a href="https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-4.13.2" rel="nofollow">“refresh tokens MUST be bound to the scope and resource servers as consented by the resource owner… to prevent privilege escalation by the legitimate client and reduce the impact of refresh token leakage.”</a> And if the authorization server issues a new refresh token during a refresh token grant, <a href="https://datatracker.ietf.org/doc/html/rfc6749#section-6" rel="nofollow">“the refresh token scope MUST be identical to that of the refresh token included by the client in the request.”</a></p>
</li>
<li>
<p dir="auto">Safeguard #2: <strong>Same Client</strong> &#8211; Furthermore, refresh tokens are <a href="https://datatracker.ietf.org/doc/html/rfc6749#section-6" rel="nofollow">“bound to the client to which it was issued”</a> and the <a href="https://datatracker.ietf.org/doc/html/rfc6749#section-10.4" rel="nofollow">authorization server is responsible</a> for maintaining this binding. The IETF threat model for OAuth2.0 clarifies that the refresh token should be bound to the original client identifier, which the <a href="https://datatracker.ietf.org/doc/html/rfc6819#section-5.2.2.2" rel="nofollow">authorization server should validate</a> with each attempt to refresh tokens.</p>
</li>
</ul>
<p dir="auto">In other words, the level of access provided by a refresh token should reflect what the resource owner originally authorized: for the same scopes, on the same resource server, and as the same client application.</p>
<p dir="auto">Microsoft has a history of bending these rules with the legacy Azure AD feature called <a href="https://www.cloudidentity.com/blog/2013/10/14/adal-windows-azure-ad-and-multi-resource-refresh-tokens/" rel="nofollow">“multi-resource refresh tokens”</a> (MRRTs). MRRTs effectively ignored the first safeguard for refresh tokens (limit access to the previously authorized scopes). Instead, MRRTs acted as “the OAuth2 equivalent of ticket granting tickets (TGTs) in Kerberos; they are artifacts that allow a user to obtain tokens to access resources the directory decides she or he has access to.” (<em>Modern Authentication with Azure Active Directory for Web Applications. Bertocci, Vittorio. 2019. Page 242-243</em>) MRRTs remained bound to the same user and client application, but Azure AD would redeem MRRTs for new bearer tokens scoped to any resources for which the client had been granted consent. Furthermore, MRRTs were not scoped by tenant. Client applications could “use MRRTs to ask for access tokens from any tenant in which the user has a guest account and has already granted consent for the client app originally used to obtain the first refresh token.” [ibid.]
<p dir="auto">MRRTs are no longer an optional feature; all Azure AD refresh tokens exhibit this behavior today. Microsoft <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/refresh-tokens" rel="nofollow">documentation</a> clearly states “Refresh tokens are bound to a combination of user and client, but aren&#8217;t tied to a resource or tenant… a client can use a refresh token to acquire access tokens across any combination of resource and tenant where it has permission to do so.”</p>
<p dir="auto">Here is a demonstration of a refresh token grant, but requesting different scopes than the original authorization. Note the content of the access token and how it differs from the previous examples.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 5 &#8211; Documented AAD Refresh Token Behavior: Different Scopes</h3>
</div>
<pre><span class="pl-s1">azure_cli_bearer_tokens_for_outlook_api</span> <span class="pl-c1">=</span> (

    <span class="pl-c"># Same client as original authorization</span>
    <span class="pl-s1">azure_cli_client</span>.<span class="pl-en">acquire_token_by_refresh_token</span>( 
        <span class="pl-s1">new_azure_cli_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(
            <span class="pl-s">"refresh_token"</span> 
        ),
        
        <span class="pl-c"># But different scopes than original authorization</span>
        <span class="pl-s1">scopes</span><span class="pl-c1">=</span>[
            <span class="pl-s">"https://outlook.office.com/.default"</span> 
        ],  
    )
)

<span class="pl-en">pprint</span>(<span class="pl-s1">azure_cli_bearer_tokens_for_outlook_api</span>)</pre>
<p dir="auto">Recent open-source projects (<a href="https://github.com/rvrsh3ll/TokenTactics">TokenTactics</a> and <a href="https://github.com/Gerenios/AADInternals">AADInternals</a>) showed, however, that it is also possible to redeem a refresh token issued to some first-party Microsoft client applications for new bearer tokens issued to a different first-party client application. This is unexpected behavior given refresh tokens safeguard #2 outlined above.</p>
<p dir="auto">To demonstrate the undocumented behavior, let&#8217;s redeem the refresh token acquired from the previous steps to acquire new bearer tokens as a <em>different</em> Microsoft client application.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 6 &#8211; Undocumented AAD Refresh Token Behavior: Different Clients</h3>
</div>
<pre><span class="pl-s1">microsoft_office_client</span> <span class="pl-c1">=</span> <span class="pl-s1">msal</span>.<span class="pl-v">PublicClientApplication</span>(<span class="pl-s">"d3590ed6-52b3-4102-aeff-aad2292ab01c"</span>)

<span class="pl-s1">microsoft_office_bearer_tokens_for_graph_api</span> <span class="pl-c1">=</span> (
    <span class="pl-c"># This is a different client application than we used in the previous examples</span>
    <span class="pl-s1">microsoft_office_client</span>.<span class="pl-en">acquire_token_by_refresh_token</span>(
        <span class="pl-c"># But we can use the refresh token issued to our original client application</span>
        <span class="pl-s1">azure_cli_bearer_tokens_for_outlook_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"refresh_token"</span>),
        <span class="pl-c"># And request different scopes too</span>
        <span class="pl-s1">scopes</span><span class="pl-c1">=</span>[<span class="pl-s">"https://graph.microsoft.com/.default"</span>],
    )
)

<span class="pl-c"># How is this possible?</span>
<span class="pl-en">pprint</span>(<span class="pl-s1">microsoft_office_bearer_tokens_for_graph_api</span>)</pre>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Part 2 &#8211; Introducing Family of Client IDs &amp; Family Refresh Tokens</h1>
</div>
<p dir="auto">The behavior demonstrated in example 6 led us to ask the following research questions:</p>
<ol dir="auto">
<li>What is the mechanism and purpose behind this undocumented behavior?</li>
<li>Which client applications are compatible with each other?</li>
<li>And most importantly: since the safeguards placed on refresh tokens were designed to reduce the risks of token replay and privilege escalation, can this behavior be abused for fun and profit?</li>
</ol>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Experiments</h2>
</div>
<p dir="auto">To learn more, we performed a series of experiments. In these experiments, we brute forced refresh token grants between combinations of known first-party Microsoft OAuth client applications. The list of first-party applications was assembled by scraping GitHub and from the enterprise applications found in our Azure AD test tenant. For each pair of clients, we requested the <code>.default</code> scope for a fixed list of common Azure AD and Microsoft 365 resource servers. After several million combinations of Microsoft client applications, the following pattern emerged in the results:</p>
<ul dir="auto">
<li>Out of a sample size of ~600 first-party Microsoft client applications, only 15 client applications were issued refresh tokens redeemable for new bearer tokens as a different client than the original access token.</li>
<li>All 15 anomalous client applications were first-party and pre-consented in our Azure AD test tenant.</li>
<li>All 15 anomalous client applications were public clients, meaning that no additional credentials were required to obtain bearer tokens.</li>
<li>There was reciprocity between all 15 anomalous client applications; all the anomalous client applications could redeem their refresh tokens for new bearer tokens for any of the other 15 anomalous client applications.</li>
<li>The scopes authorized to the newly issued access tokens were based on the new client. In other words, the client application and scopes from the original authorization did not matter. We will explore the implications of this in a later section.</li>
<li>If the same user principal was invited as a B2B guest in a different Azure AD tenant, then refresh tokens issued to any of the 15 anomalous client applications for that user in Tenant A could be redeemed for other anomalous client applications in Tenant B.</li>
<li>The authorization server returned an extra field in the JSON response when issuing bearer tokens to these 15 anomalous client applications: an additional field named <code>foci</code>. Notice that this field is present in the examples above.</li>
</ul>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1"><em>What is the mechanism and purpose behind this undocumented behavior?</em></h3>
</div>
<p dir="auto">The term “FOCI” is only <a href="https://docs.microsoft.com/en-us/azure/active-directory/reports-monitoring/concept-all-sign-ins" rel="nofollow">mentioned once</a> in official Microsoft documentation, which revealed 1) FOCI is an acronym for “Family of Client IDs” and 2) that FOCI is related to signing into multiple Microsoft Office applications on mobile devices. No further information was available on its purpose or functionality.</p>
<p dir="auto">Error codes in the responses from the authorization server led us to the open-source projects for various Microsoft Identity software development kits (SDKs) hosted on Github. A <a href="https://github.com/AzureAD/azure-activedirectory-library-for-objc/issues/453" data-hovercard-type="issue" data-hovercard-url="/AzureAD/azure-activedirectory-library-for-objc/issues/453/hovercard">Github issue</a> titled “Family of Client IDs Support” contained a description of FOCI that aligned with the observed behavior:</p>
<blockquote>
<p dir="auto">&#8220;FUTURE SERVER WORK WILL ALLOW CLIENT IDS TO BE GROUPED ON THE SERVER SIDE IN A WAY WHERE A RT FOR ONE CLIENT ID CAN BE REDEEMED FOR A AT AND RT FOR A DIFFERENT CLIENT ID AS LONG AS THEY&#8217;RE IN THE SAME GROUP. THIS WILL MOVE US CLOSER TO BEING ABLE TO PROVIDE SSO-LIKE FUNCTIONALITY BETWEEN APPS WITHOUT REQUIRING THE BROKER (OR WORKPLACE JOIN).&#8221;</p>
</blockquote>
<p dir="auto">We then found references in the source code calling refresh tokens issued to FOCI clients &#8220;family refresh tokens&#8221; (or FRTs). Based on developer remarks, it appears there is only <a href="https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/3062770948f1961a13767ee85dd7ba664440feb3/msal/application.py#L1171">one family ID currently in use</a> at Microsoft.</p>
<p dir="auto">In MSRC submission VULN-057712, Microsoft confirmed that FOCI and family refresh tokens are an intentional software feature. Microsoft engineering provided a thoughtful (and quite lengthy) response describing the origins of FOCI and its threat model, which confirmed the findings from this research. According to Microsoft, FOCI was designed to support pseudo single sign-on (SSO) functionality for Microsoft mobile applications. FOCI mirrors the behavior of mobile operating systems that store authentication artifacts (such as refresh tokens) in a shared token cache with other applications from the same software publisher.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1"><em>Which client applications are compatible with each other?</em></h3>
</div>
<p dir="auto">Here is the list of known FOCI &#8220;family&#8221; clients discovered during our experimentation:</p>
<table>
<thead>
<tr>
<th>Application ID</th>
<th>Application Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>00b41c95-dab0-4487-9791-b9d2c32c80f2</td>
<td>Office 365 Management</td>
</tr>
<tr>
<td>04b07795-8ddb-461a-bbee-02f9e1bf7b46</td>
<td>Microsoft Azure CLI</td>
</tr>
<tr>
<td>1950a258-227b-4e31-a9cf-717495945fc2</td>
<td>Microsoft Azure PowerShell</td>
</tr>
<tr>
<td>1fec8e78-bce4-4aaf-ab1b-5451cc387264</td>
<td>Microsoft Teams</td>
</tr>
<tr>
<td>26a7ee05-5602-4d76-a7ba-eae8b7b67941</td>
<td>Windows Search</td>
</tr>
<tr>
<td>27922004-5251-4030-b22d-91ecd9a37ea4</td>
<td>Outlook Mobile</td>
</tr>
<tr>
<td>4813382a-8fa7-425e-ab75-3b753aab3abb</td>
<td>Microsoft Authenticator App</td>
</tr>
<tr>
<td>ab9b8c07-8f02-4f72-87fa-80105867a763</td>
<td>OneDrive SyncEngine</td>
</tr>
<tr>
<td>d3590ed6-52b3-4102-aeff-aad2292ab01c</td>
<td>Microsoft Office</td>
</tr>
<tr>
<td>872cd9fa-d31f-45e0-9eab-6e460a02d1f1</td>
<td>Visual Studio</td>
</tr>
<tr>
<td>af124e86-4e96-495a-b70a-90f90ab96707</td>
<td>OneDrive iOS App</td>
</tr>
<tr>
<td>2d7f3606-b07d-41d1-b9d2-0d0c9296a6e8</td>
<td>Microsoft Bing Search for Microsoft Edge</td>
</tr>
<tr>
<td>844cca35-0656-46ce-b636-13f48b0eecbd</td>
<td>Microsoft Stream Mobile Native</td>
</tr>
<tr>
<td>87749df4-7ccf-48f8-aa87-704bad0e0e16</td>
<td>Microsoft Teams &#8211; Device Admin Agent</td>
</tr>
<tr>
<td>cf36b471-5b44-428c-9ce7-313bf84528de</td>
<td>Microsoft Bing Search</td>
</tr>
</tbody>
</table>
<p dir="auto">This list is not exhaustive. We believe that the presence of the <code>foci</code> field in final leg of the grant flow is a high confidence indicator that the client belongs to the FOCI &#8220;family.&#8221; We will add new clients as they are discovered in this <a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/known-foci-clients.csv">repository</a>.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1"><em>What are the security implications of Family Refresh Tokens?</em></h3>
</div>
<p dir="auto">Family refresh tokens are a special kind of refresh token that disregard the token binding safeguards defined in the OAuth 2.0 specifications. Since a family refresh token issued to any &#8220;family&#8221; client application can be redeemed for access tokens for every/any/all other family client applications, a family refresh token effectively provides the possessor with access to the union of all scopes in the family. This has some serious and likely unintended consequences given that there are hundreds of scopes with pre-consent for these FOCI &#8220;family&#8221; client applications. Microsoft argued that a risk of refresh token theft applies to all OAuth public clients, which is certainly true. But Microsoft did not acknowledge that family refresh tokens &#8211; being unbound to either client application or scope &#8211; pose a higher risk of abuse.</p>
<p dir="auto">To highlight the different levels of access afforded by the access tokens we&#8217;ve acquired so far, let&#8217;s imagine a scenario where an attacker steals tokens issued to the Azure CLI. This is quite plausible because these tokens are often stored in plain-text on disk in <code>~/.azure/accessTokens.json</code>.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 7 &#8211; Privilege Differences between Access Tokens</h3>
</div>
<pre><span class="pl-k">def</span> <span class="pl-en">read_email_messages</span>(<span class="pl-s1">access_token</span>: <span class="pl-s1">str</span>) <span class="pl-c1">-&gt;</span> <span class="pl-v">List</span>[<span class="pl-v">Dict</span>[<span class="pl-s1">str</span>, <span class="pl-v">Any</span>]]:
    <span class="pl-s">"""List the user's email messages."""</span>
    <span class="pl-s1">url</span> <span class="pl-c1">=</span> <span class="pl-s">"https://graph.microsoft.com/beta/me/mailfolders/inbox/messages"</span>
    <span class="pl-s1">headers</span> <span class="pl-c1">=</span> {
        <span class="pl-s">"Content-Type"</span>: <span class="pl-s">"application/json"</span>,
        <span class="pl-s">"Authorization"</span>: <span class="pl-s">f"Bearer <span class="pl-s1"><span class="pl-kos">{</span>access_token<span class="pl-kos">}</span></span>"</span>,
    }
    <span class="pl-k">return</span> <span class="pl-s1">requests</span>.<span class="pl-en">get</span>(<span class="pl-s1">url</span>, <span class="pl-s1">headers</span><span class="pl-c1">=</span><span class="pl-s1">headers</span>).<span class="pl-en">json</span>()</pre>
<p dir="auto">If we try to use the access token for the Azure CLI client to call the <code>/beta/me/mailfolders/inbox/messages</code> endpoint, we should receive an error message from the API. This makes sense since the Azure CLI access token does not contain <code>Mail.*</code> related scopes and the Azure CLI has no legitimate reason to read user email.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto">
<pre><span class="pl-en">read_email_messages</span>(<span class="pl-s1">azure_cli_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"access_token"</span>))</pre>
</div>
<p dir="auto">But if the attacker redeemed the family refresh token issued to the Azure CLI to acquire new tokens for a different client with the necessary scopes (as we did with the Microsoft Office client in example 6), then the attacker could read the victim user&#8217;s emails with a newly minted access token instead.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto">
<pre><span class="pl-en">read_email_messages</span>(<span class="pl-s1">microsoft_office_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"access_token"</span>))</pre>
</div>
<p dir="auto">As defenders, we need to be aware of the blast radius of a stolen (or illictly acquired) family refresh token. It is not documented (or intuitive) that stolen Azure CLI tokens can be used to perform actions that exceed the consent granted to the Azure CLI client application itself.</p>
<p dir="auto">Family refresh tokens allow privilege escalation relative to the original client application. To be clear, the scopes authorized to newly minted access tokens when redeeming family refresh tokens do not exceed the level of access for the resource owner (user) in the Azure AD directory; it doesn&#8217;t allow lower privileged users to do things that they aren&#8217;t entitled to do in Azure or Microsoft 365. In other words, the level of access provided by a FRT relative to the user&#8217;s directory role assignments is unchanged. In this context, it does not qualify as privilege escalation. But from the OAuth and practical attack perspectives, the level of access provided by family refresh tokens greatly surpasses what the resource owner authorized to any given client application.</p>
<p dir="auto">Furthermore, redeeming family refresh tokens does not invalidate previously issued refresh tokens. The following examples shows that a single family refresh token can also be used to obtain access tokens for every family client application.</p>
<div class="markdown-heading" dir="auto">
<h3 class="heading-element" dir="auto" tabindex="-1">Example 8 &#8211; Family Refresh Token Chaining</h3>
</div>
<pre><span class="pl-k">from</span> <span class="pl-s1">utils</span> <span class="pl-k">import</span> <span class="pl-s1">get_tokens_for_foci_clients</span>

<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-en">get_tokens_for_foci_clients</span>(<span class="pl-s1">azure_cli_bearer_tokens_for_graph_api</span>, <span class="pl-s1">demo</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-s1">df</span>.<span class="pl-en">head</span>()</pre>
<pre>(
    <span class="pl-s1">df</span>.<span class="pl-en">assign</span>(
        <span class="pl-s1">scp</span><span class="pl-c1">=</span><span class="pl-s1">df</span>.<span class="pl-s1">scp</span>.<span class="pl-s1">str</span>.<span class="pl-en">split</span>()
    )
    .<span class="pl-en">explode</span>(<span class="pl-s">'scp'</span>)
    .<span class="pl-en">groupby</span>([
        <span class="pl-s">'scp'</span>, 
        <span class="pl-s">'aud'</span>, 
        <span class="pl-s">'appid'</span>
    ])
    .<span class="pl-en">size</span>()
    .<span class="pl-en">to_frame</span>()
)</pre>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Part 3 &#8211; Attack Paths</h1>
<p><a id="user-content-part-3---attack-paths" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#part-3---attack-paths" aria-label="Permalink: Part 3 - Attack Paths"></a></div>
<p dir="auto">RFC 6819 enumerates a <a href="https://datatracker.ietf.org/doc/html/rfc6819#section-4.1.2" rel="nofollow">variety of attack paths</a> for malicious actors to obtain refresh tokens, all of which apply to family refresh tokens. Broadly speaking, these attacks involve either 1) stealing a previously and legitimately issued family refresh token or 2) obtaining a family refresh token through malicious authorization.</p>
<p dir="auto">There are multiple ways to steal family refresh tokens that were previously and legitimately issued to family client applications. For example, if the attacker compromises the cache where the tokens are stored (such as the Windows Web Account Manager), intercepts the tokens over network traffic during a grant flow, or finds them serialized on disk in files (such as the previous example of <code>~/.Azure/accessTokens.json</code>).</p>
<p dir="auto">We focused our attention, however, on how an attacker could obtain family refresh tokens by maliciously authorizing a family client application.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Device Code Phishing</h2>
</div>
<p dir="auto">Since the known family client applications are all so-called public clients (meaning they don’t have their own secrets), it is possible to use the <a href="https://datatracker.ietf.org/doc/html/rfc8628" rel="nofollow">device authorization grant flow</a> to obtain family refresh tokens. The device authorization grant flow has become synonymous with <a href="https://o365blog.com/post/phishing/" rel="nofollow">device code phishing</a>, a popular technique wherein the attacker tricks the victim into authorizing an OAuth application.</p>
<p dir="auto"><a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/images/device-code.png" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/dirkjanm/family-of-client-ids-research/raw/main/images/device-code.png" alt="device-code" /></a></p>
<p dir="auto">During a device code phishing attempt, the victim is presented with information about the client application that is asking for authorization. The convenient benefits of device code phishing with family client applications are 1) user consent is not required and 2) the attacker can use whatever family client application is mostly likely to socially engineer the victim in the request, then redeem its family refresh token for a new access token for a different family client application authorized for the desired scopes.</p>
<p dir="auto">We leverage device code phishing to great effect during red team engagements, especially with FOCI clients. We have <a href="https://github.com/secureworks/PhishInSuits">published a tool</a> that we use to perform these attacks on the Secureworks Github.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Abusing Single Sign-On</h2>
</div>
<p dir="auto">Another simple and effective method to obtain family refresh tokens is to abuse single sign-on on Azure AD joined devices with Pass-The-PRT attacks. The OAuth 2.0 threat model describes a scenario where an attacker might obtain a refresh token through exploiting some mechanism that <a href="https://datatracker.ietf.org/doc/html/rfc6819#section-4.4.3.3" rel="nofollow">automatically authorizes</a> client applications without knowledge or intent from the resource owner. This is trivially possible on Azure AD joined Windows devices with single sign-on enabled.</p>
<p dir="auto">Any process that executes in the context of a logged-in Azure AD user on an Azure AD-joined Windows device can <a href="https://github.com/leechristensen/RequestAADRefreshToken">request a pre-signed cookie from a COM service</a>. This cookie can then be used to complete an authorization grant flow for arbitrary OAuth applications, including family client apps. There are <a href="https://dirkjanm.io/abusing-azure-ad-sso-with-the-primary-refresh-token/" rel="nofollow">other</a> <a href="https://o365blog.com/post/prt/" rel="nofollow">ways</a> to obtain these signed cookies as well.</p>
<p dir="auto"><a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/images/sso-cs.png" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/dirkjanm/family-of-client-ids-research/raw/main/images/sso-cs.png" alt="sso-abuse" /></a></p>
<p dir="auto">Typically, the disadvantage of abusing SSO is that each time the attacker wants access to some scope that was not authorized to the stolen access token, the attacker must request a new signed cookie (or otherwise complete an authorization grant flow again) to obtain a new access token with the desired scopes. In the case of family refresh tokens, even if the attacker only generates a single pre-signed cookie, they can silently exchange the family refresh token multiple times for new access tokens for other family client applications.</p>
<p dir="auto">We have abused single sign-on to authorize FOCI clients during red team engagements. It is convenient that we can run tools such as AzureHound to minimize interactive user sign-ins when multiple tokens with the necessary scopes.</p>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Part 4 &#8211; Mitigations against Family Refresh Tokens</h1>
</div>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Conditional Access Policies</h2>
</div>
<p dir="auto">Conditional access policies still apply to family client applications and family refresh tokens. Conditional access policies that require multi-factor authentication, however, do not impede attackers from abusing legitimately issued family refresh tokens since refresh token grants are always non-interactive and usually inherit the authentication method claims from the original authorization grant. Furthermore, conditional access policies based on trusting the device are ineffective when a family client application is maliciously authorized by abusing SSO because the request does indeed originate from the trusted device.</p>
<p dir="auto">Any conditional access policies (or other controls) based purely on the family client application identifiers are trivial to bypass if another client in the family also has consent for the desired scopes. We were pleasantly surprised in recent testing that the options for cloud apps in the conditional access policy criteria appear to be based on the resource, rather than the client ID. This is significantly more secure, since defenders can focus on hardening sensitive scopes, rather than playing whack-a-mole with client applications that may be granted consent for those sensitive scopes in the future.</p>
<p dir="auto">In the response to VULN-057712, Microsoft noted that they plan to improve conditional access policies to allow restricting the issuance of family refresh tokens and unbound refresh tokens in the future.</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Auditing Sign-In Logs</h2>
</div>
<p dir="auto">Whenever a refresh token is used to obtain new bearer tokens, an event will appear in the Azure AD sign-in logs under the “User sign-ins (non-interactive)” tab.</p>
<p dir="auto"><a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/images/signins.png" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/dirkjanm/family-of-client-ids-research/raw/main/images/signins.png" alt="signins" /></a></p>
<p dir="auto"><a href="https://github.com/dirkjanm/family-of-client-ids-research/blob/main/images/signins-scopes.PNG" target="_blank" rel="noopener noreferrer"><img decoding="async" src="https://github.com/dirkjanm/family-of-client-ids-research/raw/main/images/signins-scopes.PNG" alt="signins-scopes" /></a></p>
<p dir="auto">Non-interactive sign-in events are frequently overlooked by defenders. There is currently no indication if the sign-in was done using a family refresh token. Defenders will need to monitor these logs for known FOCI client identifiers, especially when there are bursts of non-interactive sign-ins for multiple FOCI clients in a short period of time. Unfortunately, Microsoft dismissed the idea of publishing the current list of FOCI clients because the “list changes frequently with new apps and removal of old apps.”</p>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Revoking Refresh Tokens</h2>
</div>
<p dir="auto">Family refresh tokens are long-lived and provide a tremendous level of access to protected resources. Because resetting a compromised user&#8217;s password does not automatically invalidate bearer tokens that have already been issued in many circumstances, defenders must aggressively revoke refresh tokens whenever an account is suspected to be compromised.</p>
<div class="highlight highlight-source-powershell notranslate position-relative overflow-auto" dir="auto">
<pre><span class="pl-c1">Connect-AzureAD</span>
<span class="pl-c1">Revoke-AzureADUserAllRefreshToken</span> <span class="pl-k">-</span>ObjectId johndoe<span class="pl-smi">@contoso.com</span></pre>
<div class="zeroclipboard-container"></div>
</div>
<p dir="auto">A feature called <a href="https://docs.microsoft.com/en-us/azure/active-directory/conditional-access/concept-continuous-access-evaluation" rel="nofollow">continuous access evaluation</a> (CAE) enables Azure AD to notify resource servers when a “critical event” happens to a user, such as a password reset, letting the resource server reject otherwise valid tokens. CAE is not yet supported by all client applications and resource servers.</p>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Conclusion</h1>
</div>
<p dir="auto">Refresh tokens are long-lived credentials that allow anyone in possession to mint new access tokens. The scopes authorized for these access tokens determine the blast radius from refresh token theft. The OAuth 2.0 specifications include safeguards to mitigate potential risk: refresh tokens ought to be bound to the same client application and limited to the same scopes as the original authorization.</p>
<p dir="auto">The Azure AD implementation of OAuth 2.0 differs from the specification in a few important and undocumented ways. Azure AD does not enforce the safeguards for refresh tokens. All refresh tokens in Azure AD disregard the first safeguard because they are not bound to the same scopes as the original authorization. The recently discovered “Family of Client IDs” (FOCI) feature disregards both safeguards with special “family refresh tokens” (FRTs). FRTs allow the bearer to mint new access tokens for any “family” client application and for any of the scopes that the chosen family client has been granted consent.</p>
<p dir="auto">While Azure AD asks users to specifically and explicitly delegate access to third-party OAuth applications, Microsoft does not ask the same for first-party applications. Microsoft pre-authorizes many of its own OAuth applications to manage the dependencies between heavily integrated cloud services &#8211; providing so-called “implied consent” for users. All the known family client applications identified during our testing were granted implied consent and present by default in our Azure AD test tenant. But the very idea “consent” seems incompatible with the fact that the clients and scopes with pre-authorization remain unknown to users and administrators.</p>
<p dir="auto">It is reasonable for Microsoft to hide complexity that users and administrators don’t need to worry about. But undocumented features like FOCI have sufficient security implications to warrant informing defenders; anything less is just security through obscurity. Organizations must know how and why first-party applications access their data to determine legitimate business need &#8211; and be able to deny access to applications without it.</p>
<p dir="auto">In response to our MSRC submission Microsoft stated: “in the future we may move away from FOCI completely.” In the interim, the community should encourage Microsoft to publish documentation on FOCI, including a list of family client applications to monitor for potential abuse. We should be prepared to implement Microsoft’s planned improvements to conditional access policies, which would restrict the issuance of family refresh tokens. Lastly, defenders must be vigilant to revoke refresh tokens for any suspected compromised accounts.</p>
<div class="markdown-heading" dir="auto">
<h1 class="heading-element" dir="auto" tabindex="-1">Extras</h1>
</div>
<div class="markdown-heading" dir="auto">
<h2 class="heading-element" dir="auto" tabindex="-1">Example &#8211; Redeem FRT Across Tenants</h2>
<p><a id="user-content-example---redeem-frt-across-tenants" class="anchor-element" href="https://github.com/dirkjanm/family-of-client-ids-research?tab=readme-ov-file#example---redeem-frt-across-tenants" aria-label="Permalink: Example - Redeem FRT Across Tenants"></a></div>
<pre><span class="pl-k">def</span> <span class="pl-en">check_tenants_api</span>(<span class="pl-s1">access_token</span>: <span class="pl-s1">str</span>) <span class="pl-c1">-&gt;</span> <span class="pl-v">List</span>[<span class="pl-v">Dict</span>[<span class="pl-s1">str</span>, <span class="pl-v">Any</span>]]:
    <span class="pl-s1">url</span> <span class="pl-c1">=</span> <span class="pl-s">'https://management.azure.com/tenants?api-version=2020-01-01'</span>
    <span class="pl-s1">headers</span> <span class="pl-c1">=</span> {
        <span class="pl-s">'Content-Type'</span>: <span class="pl-s">'application/json'</span>,
        <span class="pl-s">'Authorization'</span>: <span class="pl-s">f'Bearer <span class="pl-s1"><span class="pl-kos">{</span>access_token<span class="pl-kos">}</span></span>'</span>
    }
    <span class="pl-k">return</span> <span class="pl-s1">requests</span>.<span class="pl-en">get</span>(<span class="pl-s1">url</span>, <span class="pl-s1">headers</span><span class="pl-c1">=</span><span class="pl-s1">headers</span>).<span class="pl-en">json</span>().<span class="pl-en">get</span>(<span class="pl-s">'value'</span>)


<span class="pl-s1">azure_cli_bearer_tokens_for_azure_mgmt_api</span> <span class="pl-c1">=</span> (
    <span class="pl-s1">azure_cli_client</span>.<span class="pl-en">acquire_token_by_refresh_token</span>( 
        <span class="pl-s1">new_azure_cli_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(
            <span class="pl-s">"refresh_token"</span> 
        ),
        <span class="pl-s1">scopes</span><span class="pl-c1">=</span>[
            <span class="pl-s">"https://management.core.windows.net/user_impersonation"</span> 
        ],  
    )
)

<span class="pl-s1">other_tenants</span> <span class="pl-c1">=</span> <span class="pl-en">check_tenants_api</span>(
    <span class="pl-s1">azure_cli_bearer_tokens_for_azure_mgmt_api</span>.<span class="pl-en">get</span>(<span class="pl-s">'access_token'</span>)
)

<span class="pl-en">pprint</span>(<span class="pl-s1">other_tenants</span>)</pre>
<div class="zeroclipboard-container"></div>
<p dir="auto">If the victim user is a B2B guest in another tenant, it should appear in the results. Pick a desired tenant ID, then run the following:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto">
<pre><span class="pl-s1">tenant_b</span> <span class="pl-c1">=</span> <span class="pl-en">input</span>(<span class="pl-s">"Provide a tenant ID: "</span>)

<span class="pl-s1">microsoft_office_client_tenant_b</span> <span class="pl-c1">=</span> <span class="pl-s1">msal</span>.<span class="pl-v">PublicClientApplication</span>(
    <span class="pl-s">"d3590ed6-52b3-4102-aeff-aad2292ab01c"</span>,
    <span class="pl-s1">authority</span><span class="pl-c1">=</span><span class="pl-s">f"https://login.microsoftonline.com/<span class="pl-s1"><span class="pl-kos">{</span>tenant_b<span class="pl-kos">}</span></span>"</span>
)

<span class="pl-s1">microsoft_office_tenant_b_bearer_tokens_for_graph_api</span> <span class="pl-c1">=</span> (
    <span class="pl-s1">microsoft_office_client_tenant_b</span>.<span class="pl-en">acquire_token_by_refresh_token</span>(
        <span class="pl-s1">azure_cli_bearer_tokens_for_azure_mgmt_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"refresh_token"</span>),
        <span class="pl-s1">scopes</span><span class="pl-c1">=</span>[<span class="pl-s">"https://graph.microsoft.com/.default"</span>],
    )
)

<span class="pl-en">pprint</span>(<span class="pl-s1">microsoft_office_tenant_b_bearer_tokens_for_graph_api</span>)

<span class="pl-en">check_my_oauth2PermissionGrants</span>(
    <span class="pl-s1">microsoft_office_tenant_b_bearer_tokens_for_graph_api</span>.<span class="pl-en">get</span>(<span class="pl-s">"access_token"</span>)
)</pre>
</div>
<p>The post <a href="http://kostacipo.stream/abusing-family-refresh-tokens-for-unauthorized-access-and-persistence-in-azure-active-directory/">Abusing Family Refresh Tokens For Unauthorized Access And Persistence In Azure Active Directory</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/abusing-family-refresh-tokens-for-unauthorized-access-and-persistence-in-azure-active-directory/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>H4X-Tools &#8211; Designed for Scraping, OSINT and Beyond</title>
		<link>http://kostacipo.stream/h4x-tools-designed-for-scraping-osint-and-beyond/</link>
					<comments>http://kostacipo.stream/h4x-tools-designed-for-scraping-osint-and-beyond/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Wed, 21 Feb 2024 23:53:50 +0000</pubDate>
				<category><![CDATA[Cybersecurity]]></category>
		<category><![CDATA[Exploitation Tools]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[scraping]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2184</guid>

					<description><![CDATA[<p>Discover the power of H4X-Tools, a versatile toolkit designed for scraping, OSINT (Open-Source Intelligence), and beyond. From extracting information from social media accounts to conducting phone and IP lookups, H4X-Tools offers a wide array of functionalities to aid researchers, developers, and security enthusiasts alike. Explore its features, installation process, and community-driven development in this article. [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/h4x-tools-designed-for-scraping-osint-and-beyond/">H4X-Tools &#8211; Designed for Scraping, OSINT and Beyond</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Discover the power of H4X-Tools, a versatile toolkit designed for scraping, OSINT (Open-Source Intelligence), and beyond.</p>
<p>From extracting information from social media accounts to conducting phone and IP lookups, H4X-Tools offers a wide array of functionalities to aid researchers, developers, and security enthusiasts alike.</p>
<p>Explore its features, installation process, and community-driven development in this article. Toolkit for scraping, OSINT and more.</p>
<p>Submit feature requests and bugs in the <a href="https://github.com/V1li/H4X-Tools/issues" target="_blank" rel="noreferrer noopener nofollow">issues</a> tab.</p>
<p>If you want to help with the development, follow the instructions in <a href="https://github.com/vil/H4X-Tools/blob/master/CONTRIBUTING.md" target="_blank" rel="noreferrer noopener nofollow">contributing</a> and simply open a pull request. You can also <a href="https://vili.dev/#donate" target="_blank" rel="noreferrer noopener nofollow">donate</a> to keep the project alive and me motivated!</p>
<h2 class="wp-block-heading"><strong>Current Tools</strong></h2>
<h3 class="wp-block-heading"><strong>Warning</strong></h3>
<p>Some tools might not work on Windows systems.</p>
<figure class="wp-block-table">
<table>
<thead>
<tr>
<th>Tool Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ig Scrape</td>
<td>Scrapes information from IG accounts.</td>
</tr>
<tr>
<td>Web Search</td>
<td>Searches the internet for the given query.</td>
</tr>
<tr>
<td>Phone Lookup</td>
<td>Looks up a phone number and returns information about it.</td>
</tr>
<tr>
<td>Ip Lookup</td>
<td>Looks up an IP/domain address and returns information about it.</td>
</tr>
<tr>
<td>Port Scanner</td>
<td>Scans for open ports in a given IP/domain address.</td>
</tr>
<tr>
<td>Username Search</td>
<td>Tries to find a given username from many different websites.</td>
</tr>
<tr>
<td>Email Search</td>
<td>Efficiently finds registered accounts from a given email. Thanks to <a href="https://github.com/megadose/holehe" target="_blank" rel="noreferrer noopener nofollow">holehe.</a></td>
</tr>
<tr>
<td>Webhook Spammer</td>
<td>Spams messages to a discord webhook.</td>
</tr>
<tr>
<td>WhoIs Lookup</td>
<td>Looks up a domain and returns information about it.</td>
</tr>
<tr>
<td>SMS Bomber</td>
<td>Spams messages to a given mobile number.</td>
</tr>
<tr>
<td>Fake Info Generator</td>
<td>Generates fake information using <a href="https://pypi.org/project/Faker/" target="_blank" rel="noreferrer noopener nofollow">Faker</a>.</td>
</tr>
<tr>
<td>Web Scrape</td>
<td>Scrapes links from a given url.</td>
</tr>
<tr>
<td>Wi-Fi Finder</td>
<td>Scans for nearby Wi-Fi networks.</td>
</tr>
<tr>
<td>Wi-Fi Password Getter</td>
<td>Scans for locally saved Wi-Fi passwords.</td>
</tr>
<tr>
<td>Dir Buster</td>
<td>Bruteforce directories on a website.</td>
</tr>
<tr>
<td>Local Accounts Getter</td>
<td>Scans for all local accounts and their information.</td>
</tr>
<tr>
<td>Caesar Cipher</td>
<td>Encrypts/decrypts/bruteforce a message using the Caesar cipher.</td>
</tr>
<tr>
<td>BaseXX</td>
<td>Encodes/decodes a message using Base64/32/16.</td>
</tr>
<tr>
<td>About</td>
<td>Tells you about the tool.</td>
</tr>
<tr>
<td>Donate</td>
<td>My crypto addresses where to donate.</td>
</tr>
<tr>
<td>Exit</td>
<td>Exits the tool.</td>
</tr>
</tbody>
</table>
</figure>
<h2 class="wp-block-heading"><strong>Note</strong></h2>
<p>-IG Scrape requires you to log in, in order to use it.</p>
<p>-SMS Bomber only works with US numbers.</p>
<p>-You might get rate limited after using some of the tools for too long.</p>
<h2 class="wp-block-heading"><strong>Installation</strong></h2>
<p>I’ll upload already built executables to the <a href="https://github.com/vil/H4X-Tools/releases" target="_blank" rel="noreferrer noopener nofollow">releases</a> tab, but I’d recommend installing the tool manually by following the instructions below. This way you also get the freshest version.</p>
<h2 class="wp-block-heading"><strong>Setup</strong></h2>
<p>Important</p>
<p>Make sure you have <a href="https://www.python.org/downloads/" target="_blank" rel="noreferrer noopener nofollow">Python</a> and <a href="https://git-scm.com/downloads" target="_blank" rel="noreferrer noopener nofollow">Git</a> installed.</p>
<p>View the <a href="https://github.com/vil/H4X-Tools/wiki" target="_blank" rel="noreferrer noopener nofollow">wiki page</a> for more detailed tutorial.</p>
<h2 class="wp-block-heading"><strong>Linux</strong></h2>
<ol>
<li>Clone the repo <code>git clone https://github.com/vil/h4x-tools.git</code></li>
<li>Change directory <code>cd h4x-tools</code></li>
<li>Run <code>sh setup.sh</code> in terminal to install the tool.</li>
</ol>
<h2 class="wp-block-heading"><strong>Windows</strong></h2>
<ol>
<li>Clone the repo <code>git clone https://github.com/vil/h4x-tools.git</code></li>
<li>Change directory <code>cd h4x-tools</code></li>
<li>Run the <code>setup.bat</code> file.</li>
</ol>
<p>Setup files will automatically build the tool as an executable. You can also run the tool using <code>python h4xtools.py</code> in the terminal.</p>
<p>Also, dependencies can be installed manually using <code>pip install -r requirements.txt</code>.</p>
<p>The post <a href="http://kostacipo.stream/h4x-tools-designed-for-scraping-osint-and-beyond/">H4X-Tools &#8211; Designed for Scraping, OSINT and Beyond</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/h4x-tools-designed-for-scraping-osint-and-beyond/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Powershell Digital Forensics And Incident Response (DFIR) – Leveraging Scripts For Effective Cybersecurity</title>
		<link>http://kostacipo.stream/powershell-digital-forensics-and-incident-response-dfir-leveraging-scripts-for-effective-cybersecurity/</link>
					<comments>http://kostacipo.stream/powershell-digital-forensics-and-incident-response-dfir-leveraging-scripts-for-effective-cybersecurity/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Wed, 21 Feb 2024 23:49:00 +0000</pubDate>
				<category><![CDATA[Cybersecurity]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Wargames]]></category>
		<category><![CDATA[Powershell Digital Forensics]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2181</guid>

					<description><![CDATA[<p>This repository contains multiple PowerShell scripts that can help you respond to cyber attacks on Windows Devices. The following Incident Response scripts are included: DFIR Script: Collects all items as listed in section DFIR Script. CollectWindowsEvents: Collects all Windows events and outputs it as CSV. CollectWindowsSecurityEvents: Collects all Windows security events and outputs it as CSV. [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/powershell-digital-forensics-and-incident-response-dfir-leveraging-scripts-for-effective-cybersecurity/">Powershell Digital Forensics And Incident Response (DFIR) – Leveraging Scripts For Effective Cybersecurity</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This repository contains multiple PowerShell scripts that can help you respond to cyber attacks on Windows Devices.</p>
<p>The following Incident Response scripts are included:</p>
<ul>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/DFIR-Script.ps1" target="_blank" rel="noreferrer noopener nofollow">DFIR Script</a>: Collects all items as listed in section <a href="https://github.com/Bert-JanP/Incident-Response-Powershell#dfir-script" target="_blank" rel="noreferrer noopener nofollow">DFIR Script</a>.</li>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/Scripts/CollectWindowsEvents.ps1" target="_blank" rel="noreferrer noopener nofollow">CollectWindowsEvents</a>: Collects all Windows events and outputs it as CSV.</li>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/Scripts/CollectWindowsSecurityEvents.ps1" target="_blank" rel="noreferrer noopener nofollow">CollectWindowsSecurityEvents</a>: Collects all Windows security events and outputs it as CSV.</li>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/Scripts/CollectPnPDevices.ps1" target="_blank" rel="noreferrer noopener nofollow">CollectPnPDevices</a>: Collects all Plug and Play devices, such as USB, Network and Storage.</li>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/Scripts/DumpLocalAdmins.ps1" target="_blank" rel="noreferrer noopener nofollow">DumpLocalAdmins</a>: Returns all local admins of a device.</li>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/Scripts/LastLogons.ps1" target="_blank" rel="noreferrer noopener nofollow">LastLogons</a> – List the last N successful logins of a device.</li>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/Scripts/ListInstalledSecurityProducts.ps1" target="_blank" rel="noreferrer noopener nofollow">ListInstalledSecurityProducts</a> – List the installed security products and their status.</li>
<li><a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/Scripts/ListDefenderExclusions.ps1" target="_blank" rel="noreferrer noopener nofollow">ListDefenderExclusions</a> – List the FolderPath, FileExtension, Process and IP exclusions that are defined.</li>
</ul>
<h2 class="wp-block-heading"><strong>DFIR Script – Extracted Artefacts</strong></h2>
<p>The <a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/DFIR-Script.ps1" target="_blank" rel="noreferrer noopener nofollow">DFIR script</a> collects information from multiple sources and structures the output in the current directory in a folder named ‘DFIR-hostname-year-month-date’.</p>
<p>This folder is zipped at the end, so that folder can be remotely collected. This script can also be used within Defender For Endpoint in a Live Response session (see below).</p>
<p>The DFIR script collects the following information when running as normal user:</p>
<ul>
<li>Local IP Info</li>
<li>Open Connections</li>
<li>Aautorun Information (Startup Folder &amp; Registry Run keys)</li>
<li>Active Users</li>
<li>Local Users</li>
<li>Connections Made From Office Applications</li>
<li>Active SMB Shares</li>
<li>RDP Sessions</li>
<li>Active Processes</li>
<li>Active USB Connections</li>
<li>Powershell History</li>
<li>DNS Cache</li>
<li>Installed Drivers</li>
<li>Installed Software</li>
<li>Running Services</li>
<li>Scheduled Tasks</li>
<li>Browser history and profile files</li>
</ul>
<p>For the best experience run the script as admin, then the following items will also be collected:</p>
<ul>
<li>Windows Security Events</li>
<li>Remotely Opened Files</li>
<li>Shadow Copies</li>
<li>MPLogs</li>
<li>Defender Exclusions</li>
</ul>
<h2 class="wp-block-heading"><strong>SIEM Import Functionality</strong></h2>
<p>The forensic artefacts are exported as CSV files, which allows responders to ingest them into their tooling. Some example tools in which you can ingest the data are Sentinel, Splunk, Elastic or Azure Data Explorer. This will allow you to perform filtering, aggregation and visualisation with your preferred query language.</p>
<p>The folder <em>CSV Results (SIEM Import Data)</em> includes all the CSV files containing the artefacts, the folder listing is shown below.</p>
<pre class="wp-block-code"><code>Name
----
ActiveUsers.csv
AutoRun.csv
ConnectedDevices.csv
DefenderExclusions.csv
DNSCache.csv
Drivers.csv
InstalledSoftware.csv
IPConfiguration.csv
LocalUsers.csv
NetworkShares.csv
OfficeConnections.csv
OpenTCPConnections.csv
PowerShellHistory.csv
Processes.csv
RDPSessions.csv
RemotelyOpenedFiles.csv
RunningServices.csv
ScheduledTasks.csv
ScheduledTasksRunInfo.csv
SecurityEvents.csv
ShadowCopy.csv
SMBShares.csv</code></pre>
<h2 class="wp-block-heading"><strong>DFIR Commands</strong></h2>
<p>The <a href="https://github.com/Bert-JanP/Incident-Response-Powershell/blob/main/DFIR-Commands.md" target="_blank" rel="noreferrer noopener nofollow">DFIR Commands page</a> contains invidividual powershell commands that can be used during your incident response process. The follwing catagories are defined:</p>
<ul>
<li>Connections</li>
<li>Persistence</li>
<li>Windows Security Events</li>
<li>Processes</li>
<li>User &amp; Group Information</li>
<li>Applications</li>
<li>File Analysis</li>
<li>Collect IOC Information</li>
</ul>
<h2 class="wp-block-heading"><strong>Windows Usage</strong></h2>
<p>The script can be excuted by running the following command.</p>
<pre class="wp-block-code"><code>.\DFIR-Script.ps1</code></pre>
<p>The script is unsigned, that could result in having to use the -ExecutionPolicy Bypass to run the script.</p>
<pre class="wp-block-code"><code>Powershell.exe -ExecutionPolicy Bypass .\DFIR-Script.ps1</code></pre>
<h2 class="wp-block-heading"><strong>DFIR Script | Defender For Endpoit Live Response Integration</strong></h2>
<p>It is possible to use the DFIR Script in combination with the Defender For Endpoint Live Repsonse. Make sure that Live Response is setup (See DOCS). Since my script is usigned a setting change must be made to able to run the script.</p>
<p>There is a blog article available that explains more about how to leverage Custom Script in Live Response: <a href="https://kqlquery.com/posts/leveraging-live-response/" target="_blank" rel="noreferrer noopener nofollow">Incident Response Part 3: Leveraging Live Response</a></p>
<p>To run unsigned scripts live Response:</p>
<ul>
<li>Security.microsoft.com</li>
<li>Settings</li>
<li>Endpoints</li>
<li>Advanced Features</li>
<li>Make sure that Live Response is enabled</li>
<li>If you want to run this on a server enable live resonse for servers</li>
<li>Enable Live Response unsigened script execution</li>
</ul>
<p>Execute script:</p>
<ul>
<li>Go to the device page</li>
<li>Initiate Live Response session</li>
<li>Upload File to library to upload script</li>
<li>After uploading the script to the library execute: <code>run DFIR-script.ps1</code> to start the script.</li>
<li>Execute <code>getfile DFIR-DeviceName-yyyy-mm-dd</code> to download the retrieved artifacts to your local machine for analysis.</li>
</ul>
<h2 class="wp-block-heading"><strong>Docs</strong></h2>
<ul>
<li><a href="https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/live-response?view=o365-worldwide" target="_blank" rel="noreferrer noopener nofollow">Microsoft Documentation Live Response</a></li>
<li><a href="https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/user-roles?view=o365-worldwide" target="_blank" rel="noreferrer noopener nofollow">DFE User permissions</a></li>
<li><a href="https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/advanced-features?view=o365-worldwide#live-response" target="_blank" rel="noreferrer noopener nofollow">Defender For Endpoint Settings Live Response</a></li>
</ul>
<p>The post <a href="http://kostacipo.stream/powershell-digital-forensics-and-incident-response-dfir-leveraging-scripts-for-effective-cybersecurity/">Powershell Digital Forensics And Incident Response (DFIR) – Leveraging Scripts For Effective Cybersecurity</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/powershell-digital-forensics-and-incident-response-dfir-leveraging-scripts-for-effective-cybersecurity/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>SqliSniper – Enhancing Web Security By Detecting SQL Injection Vulnerabilities With Python</title>
		<link>http://kostacipo.stream/sqlisniper-enhancing-web-security-by-detecting-sql-injection-vulnerabilities-with-python/</link>
					<comments>http://kostacipo.stream/sqlisniper-enhancing-web-security-by-detecting-sql-injection-vulnerabilities-with-python/#respond</comments>
		
		<dc:creator><![CDATA[Majordomo]]></dc:creator>
		<pubDate>Wed, 21 Feb 2024 23:39:18 +0000</pubDate>
				<category><![CDATA[Data]]></category>
		<category><![CDATA[Exploitation Tools]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sql injection]]></category>
		<guid isPermaLink="false">https://kostacipo.stream/?p=2177</guid>

					<description><![CDATA[<p>SqliSniper is a robust Python tool designed to detect time-based blind SQL injections in HTTP request headers. It enhances the security assessment process by rapidly scanning and identifying potential vulnerabilities using multi-threaded, ensuring speed and efficiency. Unlike other scanners, SqliSniper is designed to eliminates false positives through and send alerts upon detection, with the built-in Discord [&#8230;]</p>
<p>The post <a href="http://kostacipo.stream/sqlisniper-enhancing-web-security-by-detecting-sql-injection-vulnerabilities-with-python/">SqliSniper – Enhancing Web Security By Detecting SQL Injection Vulnerabilities With Python</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>SqliSniper</strong> is a robust Python tool designed to detect time-based blind SQL injections in HTTP request headers.</p>
<p>It enhances the security assessment process by rapidly scanning and identifying potential vulnerabilities using multi-threaded, ensuring speed and efficiency.</p>
<p>Unlike other scanners, SqliSniper is designed to eliminates false positives through and send alerts upon detection, with the built-in Discord notification functionality.</p>
<h2 class="wp-block-heading"><strong>Key Features</strong></h2>
<ul>
<li><strong>Time-Based Blind SQL Injection Detection:</strong> Pinpoints potential SQL injection vulnerabilities in HTTP headers.</li>
<li><strong>Multi-Threaded Scanning:</strong> Offers faster scanning capabilities through concurrent processing.</li>
<li><strong>Discord Notifications:</strong> Sends alerts via Discord webhook for detected vulnerabilities.</li>
<li><strong>False Positive Checks:</strong> Implements response time analysis to differentiate between true positives and false alarms.</li>
<li><strong>Custom Payload and Headers Support:</strong> Allows users to define custom payloads and headers for targeted scanning.</li>
</ul>
<h2 class="wp-block-heading"><strong>Installation</strong></h2>
<pre class="wp-block-code"><code>git clone https://github.com/danialhalo/SqliSniper.git
cd SqliSniper
chmod +x sqlisniper.py
pip3 install -r requirements.txt</code></pre>
<h2 class="wp-block-heading"><strong>Usage</strong></h2>
<p>This will display help for the tool. Here are all the options it supports.</p>
<pre class="wp-block-code"><code>ubuntu:~/sqlisniper$ ./sqlisniper.py -h


███████╗ ██████╗ ██╗     ██╗    ███████╗███╗   ██╗██╗██████╗ ███████╗██████╗
██╔════╝██╔═══██╗██║     ██║    ██╔════╝████╗  ██║██║██╔══██╗██╔════╝██╔══██╗
███████╗██║   ██║██║     ██║    ███████╗██╔██╗ ██║██║██████╔╝█████╗  ██████╔╝
╚════██║██║▄▄ ██║██║     ██║    ╚════██║██║╚██╗██║██║██╔═══╝ ██╔══╝  ██╔══██╗
███████║╚██████╔╝███████╗██║    ███████║██║ ╚████║██║██║     ███████╗██║  ██║
╚══════╝ ╚══▀▀═╝ ╚══════╝╚═╝    ╚══════╝╚═╝  ╚═══╝╚═╝╚═╝     ╚══════╝╚═╝  ╚═╝

                            -: By Muhammad Danial :-

usage: sqlisniper.py [-h] [-u URL] [-r URLS_FILE] [-p] [--proxy PROXY] [--payload PAYLOAD] [--single-payload SINGLE_PAYLOAD] [--discord DISCORD] [--headers HEADERS]
                     [--threads THREADS]

Detect SQL injection by sending malicious queries

options:
  -h, --help            show this help message and exit
  -u URL, --url URL     Single URL for the target
  -r URLS_FILE, --urls_file URLS_FILE
                        File containing a list of URLs
  -p, --pipeline        Read from pipeline
  --proxy PROXY         Proxy for intercepting requests (e.g., http://127.0.0.1:8080)
  --payload PAYLOAD     File containing malicious payloads (default is payloads.txt)
  --single-payload SINGLE_PAYLOAD
                        Single payload for testing
  --discord DISCORD     Discord Webhook URL
  --headers HEADERS     File containing headers (default is headers.txt)
  --threads THREADS     Number of threads</code></pre>
<h2 class="wp-block-heading"><strong>Running SqliSniper</strong></h2>
<h3 class="wp-block-heading"><strong>Single Url Scan</strong></h3>
<p>The url can be provided with <code>-u flag</code> for single site scan</p>
<pre class="wp-block-code"><code>./sqlisniper.py -u http://example.com</code></pre>
<h3 class="wp-block-heading"><strong>File Input</strong></h3>
<p>The <code>-r flag</code> allows SqliSniper to read a file containing multiple URLs for simultaneous scanning.</p>
<pre class="wp-block-code"><code>./sqlisniper.py -r url.txt</code></pre>
<h3 class="wp-block-heading"><strong>Piping URLs</strong></h3>
<p>The SqliSniper can also worked with the pipeline input with <code>-p flag</code></p>
<pre class="wp-block-code"><code>cat url.txt | ./sqlisniper.py -p</code></pre>
<p>The pipeline feature facilitates seamless integration with other tools. For instance, you can utilize tools like subfinder and httpx, and then pipe their output to SqliSniper for mass scanning.</p>
<pre class="wp-block-code"><code>subfinder -silent -d google.com | sort -u | httpx -silent | ./sqlisniper.py -p</code></pre>
<h3 dir="auto" tabindex="-1">Scanning with custom payloads</h3>
<p dir="auto">By default the SqliSniper use the payloads.txt file. However <code>--payload flag</code> can be used for providing custom payloads file.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>./sqlisniper.py -u http://example.com --payload mssql_payloads.txt</code></pre>
</div>
<p dir="auto">While using the custom payloads file, ensure that you substitute the sleep time with <code>%__TIME_OUT__%</code>. SqliSniper dynamically adjusts the sleep time iteratively to mitigate potential false positives. The payloads file should look like this.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>ubuntu:~/sqlisniper$ cat payloads.txt 
0\"XOR(if(now()=sysdate(),sleep(%__TIME_OUT__%),0))XOR\"Z
"0"XOR(if(now()=sysdate()%2Csleep(%__TIME_OUT__%)%2C0))XOR"Z"
0'XOR(if(now()=sysdate(),sleep(%__TIME_OUT__%),0))XOR'Z</code></pre>
</div>
<h3 dir="auto" tabindex="-1">Scanning with Single Payloads</h3>
<p dir="auto">If you want to only test with the single payload <code>--single-payload flag</code> can be used. Make sure to replace the sleep time with <code>%__TIME_OUT__%</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>./sqlisniper.py -r url.txt --single-payload "0'XOR(if(now()=sysdate(),sleep(%__TIME_OUT__%),0))XOR'Z"</code></pre>
</div>
<h3 dir="auto" tabindex="-1">Scanning Custom Header</h3>
<p dir="auto">Headers are saved in the file headers.txt for scanning custom header save the custom HTTP Request Header in headers.txt file.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>ubuntu:~/sqlisniper$ cat headers.txt 
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
X-Forwarded-For: 127.0.0.1</code></pre>
</div>
<h3 dir="auto" tabindex="-1">Sending Discord Alert Notifications</h3>
<p dir="auto">SqliSniper also offers Discord alert notifications, enhancing its functionality by providing real-time alerts through Discord webhooks. This feature proves invaluable during large-scale scans, allowing prompt notifications upon detection.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code>./sqlisniper.py -r url.txt --discord &lt;web_hookurl&gt;
</code></pre>
</div>
<h3 dir="auto" tabindex="-1">Multi-Threading</h3>
<p dir="auto">Threads can be defined with <code>--threads flag</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto">
<pre class="notranslate"><code> ./sqlisniper.py -r url.txt --threads 10
</code></pre>
<div class="zeroclipboard-container"></div>
</div>
<p dir="auto"><strong>Note:</strong> It is crucial to consider that <strong>employing a higher number of threads might lead to potential false positives or overlooking valid issues</strong>. Due to the nature of time-based SQL injection it is recommended to use lower thread for more accurate detection.</p>
<hr />
<table style="width: 99.7078%; height: 6px;">
<tbody>
<tr>
<td>
<h2 dir="auto" tabindex="-1">Legal Disclaimer</h2>
</td>
</tr>
</tbody>
</table>
<p dir="auto">Usage of this tool for attacking targets without prior mutual consent is strictly prohibited. It is the end user&#8217;s responsibility to obey all applicable local, state, and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program.</p>
<p>The post <a href="http://kostacipo.stream/sqlisniper-enhancing-web-security-by-detecting-sql-injection-vulnerabilities-with-python/">SqliSniper – Enhancing Web Security By Detecting SQL Injection Vulnerabilities With Python</a> appeared first on <a href="http://kostacipo.stream">Tech Chronicles</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://kostacipo.stream/sqlisniper-enhancing-web-security-by-detecting-sql-injection-vulnerabilities-with-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
