Exploit database

GH-9a017fa45abc7e1f8f6ba6e1285cae54

iplayforsg/cve-2023-51444

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-51444

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files5

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

community/schemaless-features/mongodb-schemaless/src/main/java/org/geoserver/schemalessfeatures/mongodb/MongoSchemalessUtils.java

Java · 2,822 bytes
/* (c) 2021 Open Source Geospatial Foundation - all rights reserved
 * This code is licensed under the GPL 2.0 license, available at the root
 * application directory.
 */
package org.geoserver.schemalessfeatures.mongodb;

import com.mongodb.DBObject;
import com.mongodb.client.MongoCollection;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.geoserver.schemalessfeatures.filter.SchemalessPropertyAccessorFactory;
import org.geotools.data.mongodb.MongoUtil;

public class MongoSchemalessUtils {

    public static final String GEOMETRY_PATH = "geometry_path";

    /**
     * Find indexed geometry attributes in the collection
     *
     * @param collection the collection into which search for indexed geometry attributes
     * @return a Set of geometry attributes
     */
    public static Set<String> findIndexedGeometries(MongoCollection collection) {
        @SuppressWarnings("unchecked")
        List<DBObject> indexes =
                (List<DBObject>)
                        collection.listIndexes(DBObject.class).into(new ArrayList<DBObject>());
        return MongoUtil.findIndexedFields(indexes, "2dsphere");
    }

    /**
     * Maps a string porperty name to a MongoDB json path
     *
     * @param pn the property name
     * @return the MongoDB json path
     */
    public static String toMongoPath(String pn) {
        String[] splittedPn = pn.split("/");
        StringBuilder sb = new StringBuilder("");
        String prev = null;
        for (int i = 0; i < splittedPn.length; i++) {
            String xpathStep = splittedPn[i];
            if (xpathStep.indexOf(":") != -1) xpathStep = xpathStep.split(":")[1];
            String nameCapitalized =
                    prev != null
                            ? prev.substring(0, 1).toUpperCase()
                                    + prev.substring(1)
                                    + SchemalessPropertyAccessorFactory.NESTED_FEATURE_SUFFIX
                            : null;
            if (!xpathStep.equals(nameCapitalized)) {
                sb.append(xpathStep);
                if (i != splittedPn.length - 1) sb.append(".");
            }
            prev = xpathStep;
        }
        return sb.toString();
    }

    /**
     * Convert a mongoPath to a PropertyName
     *
     * @param mongoPath the mongoPath
     * @return a string representation of PropertyName
     */
    public static String toPropertyName(String mongoPath) {
        return mongoPath.replaceAll("\\.", "/");
    }

    public static boolean isGeometry(DBObject object) {
        Set keys = object.keySet();
        if (keys.size() != 2 || !keys.contains("coordinates") || !keys.contains("type")) {
            // is mongo db object but not a geometry
            return false;
        }
        return true;
    }
}