https://www.owasp.org/images/7/72/OWASP_Top_10-2017_%28en%29.pdf
http://dwoo.org/what-dwoo.html
http://www.tornadoweb.org/en/stable/template.html?highlight=templating#syntax-reference
MY_TEMPLATE = '''
<html>
<head><title> Hello World! </title></head>
<body> Hello yourName </body>
</html>
'''
class myMainHandler(tornado.web.RequestHandler):
def get(self):
name = self.get_argument('name', '')
vuln_template = MY_TEMPLATE.replace("yourName",name)
t = tornado.template.Template(vuln_template)
self.write(t.generate(name=name))
class my404Handler(tornado.web.RequestHandler):
def prepare(self):
self.set_status(404)
self.render("404.html")
application = tornado.web.Application([
(r"/", myMainHandler),], default_handler_class=my404Handler,
debug=False, static_path=None, template_path=None)
if __name__ == '__main__':
application.listen(8000, address='0.0.0.0')
tornado.ioloop.IOLoop.instance().start()https://github.com/twigphp/Twig/blob/e22fb8728b395b306a06785a3ae9b12f3fbc0294/lib/Twig/Environment.php
850 public function getFilter($name)
{
...
...
foreach ($this->filterCallbacks as $callback) {
if (false !== $filter = call_user_func($callback, $name)) {
return $filter;
}
}
return false;
}
public function registerUndefinedFilterCallback($callable)
{
$this->filterCallbacks[] = $callable;
}http://php.net/manual/en/function.call-user-func.php
<?php
if (isset($_GET['submit'])) {
$name=$_GET['name'];
...
...
Twig_Autoloader::register();
try {
$loader = new Twig_Loader_String();
$twig = new Twig_Environment($loader);
// render template
$result= $twig->render($name);
echo "Hello $result";
}
catch (Exception $e) {
die ('ERROR: ' . $e->getMessage());}
}
?>
<html>
<head>
<meta charset="utf-8">
<title>1.4.7 AngularJS Sandbox Demo</title>
<script src="angular1.4.7.js"></script>
</head>
<body>
<h3>Testbed for Angular JS version 1.4.7</h3>
<form action="angular1.4.7.php">
<input type="text" size="70" name="q" value="hello world">
<input type="submit" value="go">
</form>
<hr/>
<b>Angular JS Expression:</b>
<div ng-app>
hello world
</div>
</body>
</html><?php
$q = $_GET['q'];
echo htmlspecialchars($q,ENT_QUOTES);
?>1
2
Reference: http://liveoverflow.com
lex: function(text) {
this.text = text;
this.index = 0;
this.tokens = [];
while (this.index < this.text.length) {
var ch = this.text.charAt(this.index);
if (ch === '"' || ch === "'") {
this.readString(ch);
} else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
this.readNumber();
} else if (this.isIdent(ch)) {
this.readIdent();
} else if (this.is(ch, '(){}[].,;:?')) {
this.tokens.push({index: this.index, text: ch});
this.index++;
} else if (this.isWhitespace(ch)) {
this.index++;
...
...
return this.tokens"use strict";
var fn = function(s, l, a, i) {
var v0, v1, v2, v3, v4, v5, v6, v7, v8, v9 = l && ('\u0024eval' in l),
v10;
v4 = 'a';
if (v4 != null) {
if (!(v4.constructor)) {
v4.constructor = {};
}
v3 = ensureSafeObject(v4.constructor, text);
} else {
v3 = undefined;
}
if (v3 != null) {
if (!(v3.prototype)) {
v3.prototype = {};
}
v1 = v3.prototype;
} else {
v1 = undefined;
}
if (v1 != null) {
v2 = v1.charAt;
} else {
v2 = undefined;
}
if (v1 != null) {
v5 = [];
if (v5 != null) {
v0 = v5.join;
..."use strict";
var fn = function(s, l, a, i) {
var v5, v6 = l && ('x\u003d1\u007d \u007d \u007d\u003balert\u00281\u0029\u002f\u002f' in l);
if (!(v6)) {
if (s) {
v5 = s.x = 1
}
}
};
alert(1) //;}}else{v5=l.x=1}
...
...
<?php
// Create a new curl resource
$op = curl_init();
// Set url and other options
curl_setopt($op, CURLOPT_URL, $_POST["my_url"]);
// Return the transfer as a string
curl_setopt($op, CURLOPT_RETURNTRANSFER, 1);
// Store the output string
$content = curl_exec($op);
// Echo the content and free up resources
echo $content;
curl_close($op);
?><form action="vulnSSRF.php">
<p>
<input type="text" name="my_url" placeholder="type your URL"/>
</p>
<ul class="actions">
<li><input type="submit" value="Click me!" /></li>
</ul>
</form>http://dann.com.br/ins17-insominihack-web50-smarttomcat/
public class User extends Model {
public String username;
public String password;
public boolean admin = false;
}
@helper.form(action=routes.Application.add_user()){
@helper.inputText(userForm("username"))
@helper.inputPassword(userForm("password"))
}
public static Result add_user() {
Form<User> userForm = Form.form(User.class);
User user = userForm.bindFromRequest().get();
user.save();
return redirect("/");
}
class Employee < ActiveRecord::Base
attr_accessor :username, :email, :project_id
belongs_to :project
end
class Project < ActiveRecord::Base
attr_accessor :name, :client, :secret
has_many :employees
end
project1 = Project.create(:name => "project 1", :client => "client 1",
:secret => "secret information client 1")
project2 = Project.create(:name => "project 2", :client => "client 2",
:secret => "secret information client 2")
project1.employees << Employee.create(:username => "gdieu", :email => "gdieu@gmail.com")
get "/edit" do
@employee = Employee.find(session[:employee].to_s)
render :profile
end
post "/update" do
@employee = Employee.find(session[:employee].to_s)
@employee.update_attributes(params[:employee])
@employee.save
redirect_to :profile
end