Issues (850)

Security Analysis    4 potential vulnerabilities

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection (1)
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection (2)
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  Cross-Site Scripting (1)
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.
  Header Injection
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.

includes/class-wpinv-cache-helper.php (1 issue)

Labels
Severity
1
<?php
2
if ( ! defined( 'ABSPATH' ) ) {
3
    exit; // Exit if accessed directly
4
}
5
6
/**
7
 * WPInv_Cache_Helper class.
8
 *
9
 * @class   WPInv_Cache_Helper
10
 */
11
class WPInv_Cache_Helper {
12
13
    /**
14
     * Hook in methods.
15
     */
16
    public static function init() {
17
        add_action( 'init', array( __CLASS__, 'init_hooks' ), 0 );
18
        add_action( 'admin_notices', array( __CLASS__, 'notices' ) );
19
    }
20
21
    public static function init_hooks() {
22
        if ( false === ( $page_uris = get_transient( 'wpinv_cache_excluded_uris' ) ) ) {
23
            $checkout_page = wpinv_get_option( 'checkout_page', '' );
24
            $success_page  = wpinv_get_option( 'success_page', '' );
25
            $failure_page  = wpinv_get_option( 'failure_page', '' );
26
            $history_page  = wpinv_get_option( 'invoice_history_page', '' );
27
            $subscr_page   = wpinv_get_option( 'invoice_subscription_page', '' );
28
            if ( empty( $checkout_page ) || empty( $success_page ) || empty( $failure_page ) || empty( $history_page ) || empty( $subscr_page ) ) {
29
                return;
30
            }
31
32
            $page_uris   = array();
33
34
            // Exclude querystring when using page ID
35
            $page_uris[] = 'p=' . $checkout_page;
36
            $page_uris[] = 'p=' . $success_page;
37
            $page_uris[] = 'p=' . $failure_page;
38
            $page_uris[] = 'p=' . $history_page;
39
            $page_uris[] = 'p=' . $subscr_page;
40
41
            // Exclude permalinks
42
            $checkout_page  = get_post( $checkout_page );
0 ignored issues
show
It seems like $checkout_page can also be of type string; however, parameter $post of get_post() does only seem to accept WP_Post|integer|null, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

42
            $checkout_page  = get_post( /** @scrutinizer ignore-type */ $checkout_page );
Loading history...
43
            $success_page   = get_post( $success_page );
44
            $failure_page   = get_post( $failure_page );
45
            $history_page   = get_post( $history_page );
46
            $subscr_page    = get_post( $subscr_page );
47
48
            if ( ! is_null( $checkout_page ) ) {
49
                $page_uris[] = '/' . $checkout_page->post_name;
50
            }
51
            if ( ! is_null( $success_page ) ) {
52
                $page_uris[] = '/' . $success_page->post_name;
53
            }
54
            if ( ! is_null( $failure_page ) ) {
55
                $page_uris[] = '/' . $failure_page->post_name;
56
            }
57
            if ( ! is_null( $history_page ) ) {
58
                $page_uris[] = '/' . $history_page->post_name;
59
            }
60
            if ( ! is_null( $subscr_page ) ) {
61
                $page_uris[] = '/' . $subscr_page->post_name;
62
            }
63
64
            set_transient( 'wpinv_cache_excluded_uris', $page_uris );
65
        }
66
67
        if ( is_array( $page_uris ) ) {
68
            foreach ( $page_uris as $uri ) {
69
                if ( strstr( $_SERVER['REQUEST_URI'], $uri ) ) {
70
                    self::nocache();
71
                    break;
72
                }
73
            }
74
        }
75
    }
76
77
    /**
78
     * Set nocache constants and headers.
79
     * @access private
80
     */
81
    private static function nocache() {
82
        if ( ! defined( 'DONOTCACHEPAGE' ) ) {
83
            define( 'DONOTCACHEPAGE', true );
84
        }
85
        if ( ! defined( 'DONOTCACHEOBJECT' ) ) {
86
            define( 'DONOTCACHEOBJECT', true );
87
        }
88
        if ( ! defined( 'DONOTCACHEDB' ) ) {
89
            define( 'DONOTCACHEDB', true );
90
        }
91
        nocache_headers();
92
    }
93
94
    /**
95
     * notices function.
96
     */
97
    public static function notices() {
98
        if ( ! function_exists( 'w3tc_pgcache_flush' ) || ! function_exists( 'w3_instance' ) ) {
99
            return;
100
        }
101
102
        $config   = w3_instance( 'W3_Config' );
103
        $enabled  = $config->get_integer( 'dbcache.enabled' );
104
        $settings = array_map( 'trim', $config->get_array( 'dbcache.reject.sql' ) );
105
106
        if ( $enabled && ! in_array( '_wp_session_', $settings ) ) {
107
            ?>
108
            <div class="error">
109
                <p><?php printf( wp_kses_post( __( 'In order for <strong>database caching</strong> to work with Invoicing you must add %1$s to the "Ignored Query Strings" option in <a href="%2$s">W3 Total Cache settings</a>.', 'invoicing' ) ), '<code>_wp_session_</code>', esc_url( admin_url( 'admin.php?page=w3tc_dbcache' ) ) ); ?></p>
110
            </div>
111
            <?php
112
        }
113
    }
114
}
115
116
WPInv_Cache_Helper::init();
117