Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2021-23792: Avoid fetching external resources in XMPReader. · haraldk/TwelveMonkeys@da4efe9

The package com.twelvemonkeys.imageio:imageio-metadata before 3.7.1 are vulnerable to XML External Entity (XXE) Injection due to an insecurely initialized XML parser for reading XMP Metadata. An attacker can exploit this vulnerability if they are able to supply a file (e.g. when an online profile picture is processed) with a malicious XMP segment. If the XMP metadata of the uploaded image is parsed, then the XXE vulnerability is triggered.

CVE
#vulnerability#apache#java

@@ -30,11 +30,21 @@
package com.twelvemonkeys.imageio.metadata.xmp;
import com.twelvemonkeys.imageio.metadata.Directory; import com.twelvemonkeys.imageio.metadata.Entry; import com.twelvemonkeys.imageio.metadata.MetadataReader; import com.twelvemonkeys.imageio.util.IIOUtil; import com.twelvemonkeys.lang.Validate; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map;
import javax.imageio.IIOException; import javax.imageio.stream.ImageInputStream; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -43,13 +53,11 @@ import org.xml.sax.SAXException; import org.xml.sax.helpers.DefaultHandler;
import javax.imageio.IIOException; import javax.imageio.stream.ImageInputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.IOException; import java.util.*; import com.twelvemonkeys.imageio.metadata.Directory; import com.twelvemonkeys.imageio.metadata.Entry; import com.twelvemonkeys.imageio.metadata.MetadataReader; import com.twelvemonkeys.imageio.util.IIOUtil; import com.twelvemonkeys.lang.Validate;
/** * XMPReader @@ -67,10 +75,9 @@ public final class XMPReader extends MetadataReader { public Directory read(final ImageInputStream input) throws IOException { Validate.notNull(input, “input”);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true);
try { DocumentBuilderFactory factory = createDocumentBuilderFactory();
// TODO: Consider parsing using SAX? // TODO: Determine encoding and parse using a Reader… // TODO: Refactor scanner to return inputstream? @@ -79,9 +86,6 @@ public Directory read(final ImageInputStream input) throws IOException { builder.setErrorHandler(new DefaultHandler()); Document document = builder.parse(new InputSource(IIOUtil.createStreamAdapter(input)));
// XMLSerializer serializer = new XMLSerializer(System.err, System.getProperty(“file.encoding”)); // serializer.serialize(document);
String toolkit = getToolkit(document); Node rdfRoot = document.getElementsByTagNameNS(XMP.NS_RDF, “RDF”).item(0); NodeList descriptions = document.getElementsByTagNameNS(XMP.NS_RDF, “Description”); @@ -92,10 +96,33 @@ public Directory read(final ImageInputStream input) throws IOException { throw new IIOException(e.getMessage(), e); } catch (ParserConfigurationException e) { throw new RuntimeException(e); // TODO: Or IOException? throw new RuntimeException(e); } }
private DocumentBuilderFactory createDocumentBuilderFactory() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true);
// Security: Disable XInclude & expanding entity references (“bombs”), not needed for XMP factory.setXIncludeAware(false); factory.setExpandEntityReferences(false);
// Security: Enable "secure processing", to prevent DoS attacks factory.setAttribute(XMLConstants.FEATURE_SECURE_PROCESSING, true);
// Security: Remove possibility to access external DTDs or Schema, not needed for XMP factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, “”); factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, “”);
// Security: Disable loading of external DTD and entities, not needed for XMP factory.setFeature("http://xml.org/sax/features/external-general-entities", false); factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
return factory; }
private String getToolkit(Document document) { NodeList xmpmeta = document.getElementsByTagNameNS(XMP.NS_X, “xmpmeta”);
@@ -109,7 +136,7 @@ private String getToolkit(Document document) { }
private XMPDirectory parseDirectories(final Node pParentNode, NodeList pNodes, String toolkit) { Map<String, List<Entry>> subdirs = new LinkedHashMap<String, List<Entry>>(); Map<String, List<Entry>> subdirs = new LinkedHashMap<>();
for (Node desc : asIterable(pNodes)) { if (desc.getParentNode() != pParentNode) { @@ -127,7 +154,7 @@ private XMPDirectory parseDirectories(final Node pParentNode, NodeList pNodes, S // Lookup List<Entry> dir = subdirs.get(node.getNamespaceURI()); if (dir == null) { dir = new ArrayList<Entry>(); dir = new ArrayList<>(); subdirs.put(node.getNamespaceURI(), dir); }
@@ -139,7 +166,7 @@ private XMPDirectory parseDirectories(final Node pParentNode, NodeList pNodes, S else { // TODO: This method contains loads of duplication an should be cleaned up… // Support attribute short-hand syntax Map<String, List<Entry>> subsubdirs = new LinkedHashMap<String, List<Entry>>(); Map<String, List<Entry>> subsubdirs = new LinkedHashMap<>();
parseAttributesForKnownElements(subsubdirs, node);
@@ -161,7 +188,7 @@ private XMPDirectory parseDirectories(final Node pParentNode, NodeList pNodes, S } }
List<Directory> entries = new ArrayList<Directory>(subdirs.size()); List<Directory> entries = new ArrayList<>(subdirs.size());
// TODO: Should we still allow asking for a subdirectory by item id? for (Map.Entry<String, List<Entry>> entry : subdirs.entrySet()) { @@ -179,7 +206,7 @@ private boolean isResourceType(Node node) {
private RDFDescription parseAsResource(Node node) { // See: http://www.w3.org/TR/REC-rdf-syntax/#section-Syntax-parsetype-resource List<Entry> entries = new ArrayList<Entry>(); List<Entry> entries = new ArrayList<>();
for (Node child : asIterable(node.getChildNodes())) { if (child.getNodeType() != Node.ELEMENT_NODE) { @@ -204,7 +231,7 @@ private void parseAttributesForKnownElements(Map<String, List<Entry>> subdirs, N List<Entry> dir = subdirs.get(attr.getNamespaceURI());
if (dir == null) { dir = new ArrayList<Entry>(); dir = new ArrayList<>(); subdirs.put(attr.getNamespaceURI(), dir); }
@@ -216,7 +243,7 @@ private Object getChildTextValue(final Node node) { for (Node child : asIterable(node.getChildNodes())) { if (XMP.NS_RDF.equals(child.getNamespaceURI()) && "Alt".equals(child.getLocalName())) { // Support for <rdf:Alt><rdf:li> -> return a Map<String, Object> keyed on xml:lang Map<String, Object> alternatives = new LinkedHashMap<String, Object>(); Map<String, Object> alternatives = new LinkedHashMap<>(); for (Node alternative : asIterable(child.getChildNodes())) { if (XMP.NS_RDF.equals(alternative.getNamespaceURI()) && "li".equals(alternative.getLocalName())) { NamedNodeMap attributes = alternative.getAttributes(); @@ -230,7 +257,7 @@ private Object getChildTextValue(final Node node) { else if (XMP.NS_RDF.equals(child.getNamespaceURI()) && ("Seq".equals(child.getLocalName()) || "Bag".equals(child.getLocalName()))) { // Support for <rdf:Seq><rdf:li> -> return array // Support for <rdf:Bag><rdf:li> -> return array/unordered collection (how can a serialized collection not have order?) List<Object> seq = new ArrayList<Object>(); List<Object> seq = new ArrayList<>();
for (Node sequence : asIterable(child.getChildNodes())) { if (XMP.NS_RDF.equals(sequence.getNamespaceURI()) && "li".equals(sequence.getLocalName())) {

Related news

CVE-2022-27183: Splunk XSS in Monitoring Console

The Monitoring Console app configured in Distributed mode allows for a Reflected XSS in a query parameter in Splunk Enterprise versions before 8.1.4. The Monitoring Console app is a bundled app included in Splunk Enterprise, not for download on SplunkBase, and not installed on Splunk Cloud Platform instances. Note that the Cloud Monitoring Console is not impacted.

CVE-2022-28005: Security & Memory Hotfix Available for V18 Update 3

An issue was discovered in the 3CX Phone System Management Console prior to version 18 Update 3 FINAL. An unauthenticated attacker could abuse improperly secured access to arbitrary files on the server, leading to cleartext credential disclosure. Afterwards, the authenticated attacker is able to upload a file that overwrites a 3CX service binary, leading to Remote Code Execution as NT AUTHORITY\SYSTEM on Windows installations. Versions prior to version 18, Hotfix 1 Build 18.0.3.461 March 2022, are prone to an additional unauthenticated file system access to C:\Windows\System32.

Red Hat Security Advisory 2022-1739-01

Red Hat Security Advisory 2022-1739-01 - Red Hat OpenShift Service Mesh is Red Hat's distribution of the Istio service mesh project, tailored for installation into an on-premise OpenShift Container Platform installation. This advisory covers the containers for the release.

CVE-2021-25746: [Security Advisory] CVE-2021-25746: Ingress-nginx directive injection via annotations

A security issue was discovered in ingress-nginx where a user that can create or update ingress objects can use .metadata.annotations in an Ingress object (in the networking.k8s.io or extensions API group) to obtain the credentials of the ingress-nginx controller. In the default configuration, that credential has access to all secrets in the cluster.

CVE-2021-25745: CVE-2021-25745: Ingress-nginx `path` can be pointed to service account token file · Issue #8502 · kubernetes/ingress-nginx

A security issue was discovered in ingress-nginx where a user that can create or update ingress objects can use the spec.rules[].http.paths[].path field of an Ingress object (in the networking.k8s.io or extensions API group) to obtain the credentials of the ingress-nginx controller. In the default configuration, that credential has access to all secrets in the cluster.

RHSA-2022:1739: Red Hat Security Advisory: Red Hat OpenShift Service Mesh 2.1.2.1 containers security update

An update for is now available for OpenShift Service Mesh 2.1. Red Hat Product Security has rated this update as having a security impact of Moderate. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available for each vulnerability from the CVE link(s) in the References section.This content is licensed under the Creative Commons Attribution 4.0 International License (https://creativecommons.org/licenses/by/4.0/). If you distribute this content, or a modified version of it, you must provide attribution to Red Hat Inc. and provide a link to the original. Related CVEs: * CVE-2021-44906: minimist: prototype pollution * CVE-2022-0235: node-fetch: exposure of sensitive information to an unauthorized actor * CVE-2022-0536: follow-redirects: Exposure of Sensitive Information via Authorization Header leak * CVE-2022-24771: node-forge: Signature verification leniency in checking `digestAlgorithm` structure can lead to signature forgery * CVE-2...

Red Hat Security Advisory 2022-1730-01

Red Hat Security Advisory 2022-1730-01 - Mozilla Thunderbird is a standalone mail and newsgroup client. This update upgrades Thunderbird to version 91.9.0. Issues addressed include a bypass vulnerability.

Red Hat Security Advisory 2022-1726-01

Red Hat Security Advisory 2022-1726-01 - Mozilla Thunderbird is a standalone mail and newsgroup client. This update upgrades Thunderbird to version 91.9.0. Issues addressed include a bypass vulnerability.

Red Hat Security Advisory 2022-1734-01

Red Hat Security Advisory 2022-1734-01 - The Migration Toolkit for Containers enables you to migrate Kubernetes resources, persistent volume data, and internal container images between OpenShift Container Platform clusters, using the MTC web console or the Kubernetes API.

Red Hat Security Advisory 2022-1727-01

Red Hat Security Advisory 2022-1727-01 - Mozilla Thunderbird is a standalone mail and newsgroup client. This update upgrades Thunderbird to version 91.9.0. Issues addressed include a bypass vulnerability.

Red Hat Security Advisory 2022-1724-01

Red Hat Security Advisory 2022-1724-01 - Mozilla Thunderbird is a standalone mail and newsgroup client. This update upgrades Thunderbird to version 91.9.0. Issues addressed include a bypass vulnerability.

Red Hat Security Advisory 2022-1725-01

Red Hat Security Advisory 2022-1725-01 - Mozilla Thunderbird is a standalone mail and newsgroup client. This update upgrades Thunderbird to version 91.9.0. Issues addressed include a bypass vulnerability.

Red Hat Security Advisory 2022-1716-01

Red Hat Security Advisory 2022-1716-01 - Red Hat Ceph Storage is a scalable, open, software-defined storage platform that combines the most stable version of the Ceph storage system with a Ceph management platform, deployment utilities, and support services. Issues addressed include bypass, crlf injection, and memory leak vulnerabilities.

Red Hat Security Advisory 2022-1715-01

Red Hat Security Advisory 2022-1715-01 - Red Hat Advanced Cluster Management for Kubernetes 2.3.10 images Red Hat Advanced Cluster Management for Kubernetes provides the capabilities to address common challenges that administrators and site reliability engineers face as they work across a range of public and private cloud environments. Clusters and applications are all visible and managed from a single console—with security policy built in. This advisory contains the container images for Red Hat Advanced Cluster Management for Kubernetes, which fix several bugs. Issues addressed include bypass and traversal vulnerabilities.

Red Hat Security Advisory 2022-1620-01

Red Hat Security Advisory 2022-1620-01 - Red Hat OpenShift Container Platform is Red Hat's cloud computing Kubernetes application platform solution designed for on-premise or private cloud deployments. This advisory contains the RPM packages for Red Hat OpenShift Container Platform 4.6.57. Issues addressed include bypass and denial of service vulnerabilities.

Red Hat Security Advisory 2022-1713-01

Red Hat Security Advisory 2022-1713-01 - The rh-sso-7/sso75-openshift-rhel8 container image has been updated for RHEL-8 based Middleware Containers. Issues addressed include a privilege escalation vulnerability.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907