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 files22

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

web/wms/src/main/java/org/geoserver/wms/web/publish/LegendGraphicAjaxUpdater.java

Java · 1,936 bytes
/* (c) 2014 - 2016 Open Source Geospatial Foundation - all rights reserved
 * (c) 2001 - 2013 OpenPlans
 * This code is licensed under the GPL 2.0 license, available at the root
 * application directory.
 */
package org.geoserver.wms.web.publish;

import java.io.Serializable;
import org.apache.wicket.AttributeModifier;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.geoserver.catalog.StyleInfo;

/**
 * Helper class for a wicket ajax behavior that updates the {@code src} attribute of an {@link
 * Image} component to point to a WMS GetLegendGraphic request.
 *
 * @author Gabriel Roldan
 * @sicne 2.1
 */
class LegendGraphicAjaxUpdater implements Serializable {

    private static final long serialVersionUID = 5543647283072466506L;

    private Image image;

    private IModel<StyleInfo> styleInfoModel;
    private IModel<String> urlModel;

    private String wmsURL;

    public LegendGraphicAjaxUpdater(
            final String wmsURL, final Image image, final IModel<StyleInfo> styleInfoModel) {
        this.wmsURL = wmsURL;
        this.image = image;
        this.styleInfoModel = styleInfoModel;
        this.urlModel = new Model<>(wmsURL);
        this.image.add(new AttributeModifier("src", urlModel));
        updateStyleImage(null);
    }

    public void updateStyleImage(AjaxRequestTarget target) {
        String url =
                wmsURL
                        + "REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&STRICT=false&style=";
        StyleInfo styleInfo = styleInfoModel.getObject();
        if (styleInfo != null) {
            String style = styleInfo.prefixedName();
            url += style;
            urlModel.setObject(url);
            if (target != null) {
                target.add(image);
            }
        }
    }
}