Fix XXE lesson, the exact .webgoat directory including version number will be put in the lesson.
This commit is contained in:
parent
672d78eebc
commit
245ba2c3d1
@ -35,6 +35,7 @@ import com.google.common.collect.Sets;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.asciidoctor.Asciidoctor;
|
import org.asciidoctor.Asciidoctor;
|
||||||
import org.asciidoctor.extension.JavaExtensionRegistry;
|
import org.asciidoctor.extension.JavaExtensionRegistry;
|
||||||
|
import org.owasp.webgoat.asciidoc.WebGoatVersionMacro;
|
||||||
import org.owasp.webgoat.asciidoc.WebWolfMacro;
|
import org.owasp.webgoat.asciidoc.WebWolfMacro;
|
||||||
import org.owasp.webgoat.i18n.Language;
|
import org.owasp.webgoat.i18n.Language;
|
||||||
import org.thymeleaf.TemplateProcessingParameters;
|
import org.thymeleaf.TemplateProcessingParameters;
|
||||||
@ -86,6 +87,7 @@ public class AsciiDoctorTemplateResolver extends TemplateResolver {
|
|||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
JavaExtensionRegistry extensionRegistry = asciidoctor.javaExtensionRegistry();
|
JavaExtensionRegistry extensionRegistry = asciidoctor.javaExtensionRegistry();
|
||||||
extensionRegistry.inlineMacro("webWolfLink", WebWolfMacro.class);
|
extensionRegistry.inlineMacro("webWolfLink", WebWolfMacro.class);
|
||||||
|
extensionRegistry.inlineMacro("webGoatVersion", WebGoatVersionMacro.class);
|
||||||
|
|
||||||
asciidoctor.convert(new InputStreamReader(is), writer, createAttributes());
|
asciidoctor.convert(new InputStreamReader(is), writer, createAttributes());
|
||||||
return new ByteArrayInputStream(writer.getBuffer().toString().getBytes(UTF_8));
|
return new ByteArrayInputStream(writer.getBuffer().toString().getBytes(UTF_8));
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
package org.owasp.webgoat.asciidoc;
|
||||||
|
|
||||||
|
import org.asciidoctor.ast.AbstractBlock;
|
||||||
|
import org.asciidoctor.extension.InlineMacroProcessor;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class WebGoatVersionMacro extends InlineMacroProcessor {
|
||||||
|
|
||||||
|
public WebGoatVersionMacro(String macroName, Map<String, Object> config) {
|
||||||
|
super(macroName, config);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String process(AbstractBlock parent, String target, Map<String, Object> attributes) {
|
||||||
|
return EnvironmentExposure.getEnv().getProperty("webgoat.build.version");
|
||||||
|
}
|
||||||
|
}
|
@ -76,14 +76,13 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li role="presentation" class="divider"></li>
|
<li role="presentation" class="divider"></li>
|
||||||
<li role="presentation" class="disabled"><a role="menuitem" tabindex="-1" href="#"
|
<li role="presentation" class="disabled"><a role="menuitem" tabindex="-1" href="#">
|
||||||
th:text="#{version}">Version: <span
|
<span th:text="#{version}">Version:</span><span>: </span>
|
||||||
th:text="${@environment.getProperty('webgoat.build.version')}"></span></a>
|
<span th:text="${@environment.getProperty('webgoat.build.version')}"></span></a>
|
||||||
</li>
|
</li>
|
||||||
<li role="presentation" class="disabled"><a role="menuitem" tabindex="-1" href="#"
|
<li role="presentation" class="disabled"><a role="menuitem" tabindex="-1" href="#">
|
||||||
th:text="#{build}">Build:
|
<span th:text="#{build}">Build:</span><span>: </span>
|
||||||
<span th:text="${@environment.getProperty('webgoat.build.number')}"></span></a></li>
|
<span th:text="${@environment.getProperty('webgoat.build.number')}"></span></a></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div style="display:inline" id="settings">
|
<div style="display:inline" id="settings">
|
||||||
|
@ -9,13 +9,13 @@ DTD.
|
|||||||
|OS |Location
|
|OS |Location
|
||||||
|
|
||||||
|Linux
|
|Linux
|
||||||
|`/home/USER/.webgoat/XXE/secret.txt`
|
|`/home/USER/.webgoat-webGoatVersion:version[]/XXE/secret.txt`
|
||||||
|
|
||||||
|Windows
|
|Windows
|
||||||
|`c:/Users/USER/.webgoat/XXE/secret.txt`
|
|`c:/Users/USER/.webgoat-webGoatVersion:version[]/XXE/secret.txt`
|
||||||
|
|
||||||
|Docker
|
|Docker
|
||||||
|`/home/webgoat/.webgoat/XXE/secret.txt`
|
|`/home/webgoat/.webgoat-webGoatVersion:version[]/XXE/secret.txt`
|
||||||
|===
|
|===
|
||||||
|
|
||||||
Try to upload this file using WebWolf landing page for example: `http://localhost:8081/WebWolf/landing?text=[contents_file]`
|
Try to upload this file using WebWolf landing page for example: `http://localhost:8081/WebWolf/landing?text=[contents_file]`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user