Issues (17)

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.

src/services/RuCaptchaGeeTest.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
namespace jumper423\decaptcha\services;
4
5
use jumper423\decaptcha\core\DeCaptchaErrors;
6
7
/**
8
 * Class RuCaptchaGeeTest.
9
 */
10
class RuCaptchaGeeTest extends RuCaptcha
11
{
12
    public function init()
13
    {
14
        parent::init();
15
16
        unset(
17
            $this->paramsNames[static::ACTION_FIELD_FILE],
18
            $this->paramsNames[static::ACTION_FIELD_PHRASE],
19
            $this->paramsNames[static::ACTION_FIELD_REGSENSE],
20
            $this->paramsNames[static::ACTION_FIELD_NUMERIC],
21
            $this->paramsNames[static::ACTION_FIELD_MIN_LEN],
22
            $this->paramsNames[static::ACTION_FIELD_MAX_LEN],
23
            $this->paramsNames[static::ACTION_FIELD_LANGUAGE],
24
            $this->paramsNames[static::ACTION_FIELD_LANG],
25
            $this->paramsNames[static::ACTION_FIELD_QUESTION],
26
            $this->paramsNames[static::ACTION_FIELD_INSTRUCTIONS],
27
            $this->paramsNames[static::ACTION_FIELD_CALC],
28
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_FILE],
29
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PHRASE],
30
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_REGSENSE],
31
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_NUMERIC],
32
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MIN_LEN],
33
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_MAX_LEN],
34
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANGUAGE],
35
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_LANG],
36
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_QUESTION],
37
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_INSTRUCTIONS],
38
            $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_CALC]
39
        );
40
41
        $this->paramsNames[static::ACTION_FIELD_PAGEURL] = 'pageurl';
42
        $this->paramsNames[static::ACTION_FIELD_GT] = 'gt';
43
        $this->paramsNames[static::ACTION_FIELD_CHALLENGE] = 'challenge';
44
        $this->paramsNames[static::ACTION_FIELD_API_SERVER] = 'api_server';
45
46
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_METHOD][static::PARAM_SLUG_DEFAULT] = 'geetest';
47
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_PAGEURL] = [
48
            static::PARAM_SLUG_REQUIRE => true,
49
            static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_STRING,
50
        ];
51
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_GT] = [
52
            static::PARAM_SLUG_REQUIRE => true,
53
            static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_STRING,
54
        ];
55
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_CHALLENGE] = [
56
            static::PARAM_SLUG_REQUIRE => true,
57
            static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_STRING,
58
        ];
59
        $this->actions[static::ACTION_RECOGNIZE][static::ACTION_FIELDS][static::ACTION_FIELD_API_SERVER] = [
60
            static::PARAM_SLUG_REQUIRE => true,
61
            static::PARAM_SLUG_TYPE    => static::PARAM_FIELD_TYPE_STRING,
62
        ];
63
64
        $this->wiki->setText(['service', 'name'], [
65
            'ru' => 'RuCaptcha GeeTest',
66
            'en' => 'RuCaptcha GeeTest',
67
        ]);
68
        $this->wiki->setText(['recognize', 'price'], [
69
            'ru' => '1000 решений стоят 39 рублей.',
70
            'en' => '1000 for $0,7',
71
        ]);
72
        $this->wiki->setText(['recognize', 'desc'], [
73
            'ru' => '1) Найти следующие параметры на странице сайта с капчей (обычно их можно найти внутри функции initGeetest):
74
75
gt - публичный ключ сайта (статический)
76
challenge - динамический ключ задания
77
api_server - домен API (обязателен для некоторых сайтов)
78
79
2) Отправьте запрос 
80
81
3) Используйте значения, полученные в ответе в запросе к сайту, передавая их в соотстветствующих полях запроса:
82
83
geetest_challenge
84
geetest_validate
85
geetest_seccode',
86
            'en' => '1) Find the following parameters on the site page with captcha (they can usually be found inside the initGeetest function):
87
88
gt - site public key (static)
89
challenge - dynamic task key
90
api_server - API domain (required for some sites)
91
92
2) Submit a request
93
94
3) Use the values received in the response in the request to the site, passing them in the corresponding request fields:
95
96
geetest_challenge
97
geetest_validate
98
geetest_seccode',
99
        ]);
100
        $this->wiki->setText(['recognize', 'data'], [
101
            static::ACTION_FIELD_PAGEURL    => 'http://mysite.com/page/with/gettest/',
102
            static::ACTION_FIELD_GT         => 'f1ab2cdefa3456789012345b6c78d90e',
103
            static::ACTION_FIELD_CHALLENGE  => '12345678abc90123d45678ef90123a456b',
104
            static::ACTION_FIELD_API_SERVER => 'api-na.geetest.com',
105
        ]);
106
        $this->wiki->setText(['recognize', 'file'], false);
107
        $this->wiki->setText(['menu', 'from_service'], [
108
            RuCaptcha::class,
109
            RuCaptchaClick::class,
110
            RuCaptchaInstruction::class,
111
            RuCaptchaGrid::class,
112
            RuCaptchaReCaptcha::class,
113
            RuCaptchaFunCaptcha::class,
114
            RuCaptchaReCaptchaV3::class,
115
            RuCaptchaKeyCaptcha::class,
116
        ]);
117
    }
118
119
    public function recognize($additionally = [], $null = null)
120
    {
121
        return parent::recognize(null, $additionally);
122
    }
123
124
    /**
125
     * @param $action
126
     * @param $data
127
     *
128
     * @throws DeCaptchaErrors
129
     *
130
     * @return array
131
     */
132
    protected function decodeResponse($action, $data)
133
    {
134
        if (!array_key_exists($action, $this->decodeSettings[static::DECODE_ACTION])) {
135
            throw new DeCaptchaErrors('нет action');
136
        }
137
        $decodeSetting = $this->decodeSettings[static::DECODE_ACTION][$action];
138
        $values = [];
139
        if ($data === '{') {
140
            $values[static::DECODE_PARAM_RESPONSE] = 'OK';
141
            $values[static::DECODE_PARAM_CODE] = json_decode($data, true);
142
        } else {
143 View Code Duplication
            foreach (explode($decodeSetting[static::DECODE_SEPARATOR], $data) as $key => $value) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
144
                foreach ($decodeSetting[static::DECODE_PARAMS] as $param => $paramSetting) {
145
                    if ($key === $paramSetting[static::DECODE_PARAM_SETTING_MARKER]) {
146
                        $values[$param] = $value;
147
                    }
148
                }
149
            }
150
        }
151
152
        return $values;
153
    }
154
}
155