Issues (2)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

stencil-engine.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * Engine code
4
 *
5
 * @package Stencil
6
 * @subpackage Smarty3
7
 */
8
9
/**
10
 * Double check to make sure Stencil is loaded
11
 */
12
if ( class_exists( 'Stencil_Implementation' ) ) :
13
14
	/**
15
	 * Create new instance on init
16
	 */
17
	add_action( 'init', create_function( '', 'new Stencil_Smarty_3();' ) );
0 ignored issues
show
Security Best Practice introduced by
The use of create_function is highly discouraged, better use a closure.

create_function can pose a great security vulnerability as it is similar to eval, and could be used for arbitrary code execution. We highly recommend to use a closure instead.

// Instead of
$function = create_function('$a, $b', 'return $a + $b');

// Better use
$function = function($a, $b) { return $a + $b; }
Loading history...
18
19
	/**
20
	 * Class stencil_smarty3
21
	 *
22
	 * Implementation of the "Smarty 3.x" templating engine
23
	 */
24
	class Stencil_Smarty_3 extends Stencil_Implementation {
25
26
		/**
27
		 * Initialize Smarty3 and set defaults
28
		 */
29
		public function __construct() {
30
			parent::__construct();
31
32
			require_once( 'lib/Smarty/Smarty.class.php' );
33
34
			$this->engine = new Smarty();
35
			$this->engine->setCacheDir( $this->cache_path );
36
			$this->engine->setCompileDir( $this->compile_path );
37
			$this->engine->setTemplateDir( $this->template_path );
38
39
			/**
40
			 * For config see:
41
			 * http://www.smarty.net/docs/en/config.files.tpl
42
			 */
43
44
			/*
45
			 * $this->engine->setConfigDir( $template_dir . 'configs/');
46
			 */
47
48
			// Add custom plugins to smarty (per template).
49
			$plugin_dir = apply_filters( 'smarty3-template-plugin-dir', 'smarty-plugins' );
50
51
			/**
52
			 * Add theme plugins & child-theme plugins
53
			 */
54
			if ( ! empty( $plugin_dir ) ) {
55
				$template_root = get_template_directory();
56
				$plugin_bases  = array( $template_root );
57
58
				$child_root = get_stylesheet_directory();
59
				if ( $child_root !== $template_root ) {
60
					$plugin_bases[] = $child_root;
61
				}
62
63
				foreach ( $plugin_bases as $plugin_base ) {
64
					$plugin_dir = implode( DIRECTORY_SEPARATOR, array( $plugin_base, $plugin_dir, '' ) );
65
					if ( is_dir( $plugin_dir ) ) {
66
						$this->engine->addPluginsDir( $plugin_dir );
67
					}
68
				}
69
			}
70
71
			/**
72
			 * Caching - when and how?
73
			 * http://www.smarty.net/docsv2/en/caching.tpl
74
			 */
75
			$this->engine->caching = 0;
76
77
			$this->ready();
78
		}
79
80
		/**
81
		 * Sets the variable to value
82
		 *
83
		 * @param string $variable Variable to set.
84
		 * @param mixed  $value Value to apply.
85
		 *
86
		 * @return mixed|void
87
		 */
88
		public function set( $variable, $value ) {
89
			if ( is_object( $value ) ) {
90
				$this->engine->assignByRef( $variable, $value );
91
			} else {
92
				$this->engine->assign( $variable, $value );
93
			}
94
95
			return $this->get( $variable );
96
		}
97
98
		/**
99
		 * Gets the value of variable
100
		 *
101
		 * @param string $variable Variable to read.
102
		 *
103
		 * @return mixed|string
104
		 */
105
		public function get( $variable ) {
106
			return $this->engine->getTemplateVars( $variable );
107
		}
108
109
		/**
110
		 * Fetches the Smarty compiled template
111
		 *
112
		 * @param string $template Template file to get.
113
		 *
114
		 * @return string
115
		 */
116
		public function fetch( $template ) {
117
			return $this->engine->fetch( $template );
118
		}
119
	}
120
121
endif;
122