Issues (302)

Security Analysis    not enabled

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.

examples/SafeBrowsing/index.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
 * Example of usage Yandex\SafeBrowsing package
4
 *
5
 * @author   Alexander Khaylo <[email protected]>
6
 * @created  31.01.14 18:47
7
 */
8
9
use Yandex\SafeBrowsing\SafeBrowsingClient;
10
use Yandex\SafeBrowsing\SafeBrowsingException;
11
use Yandex\Common\Exception\YandexException;
12
13
?>
14
<!doctype html>
15
<html lang="en-US">
16
<head>
17
    <meta charset="UTF-8">
18
    <title>Yandex PHP Library: Safe Browsing Demo</title>
19
20
    <link rel="stylesheet" href="//yandex.st/bootstrap/3.0.0/css/bootstrap.min.css">
21
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
22
    <link rel="stylesheet" href="/examples/Disk/css/style.css">
23
    <style>
24
        .btn {
25
            padding: 6px 12px;
26
        }
27
    </style>
28
29
</head>
30
<body>
31
32
<div class="container">
33
    <div class="jumbotron">
34
        <h2><span class="glyphicon glyphicon glyphicon-certificate"></span> Пример работы с Safe Browsing API Яндекса</h2>
35
    </div>
36
    <ol class="breadcrumb">
37
        <li><a href="/examples">Examples</a></li>
38
        <li class="active">SafeBrowsing</li>
39
    </ol>
40
    <h3>Проверить адреса</h3>
41
    <?php
42
    try {
43
44
        $settings = require_once '../settings.php';
45
46 View Code Duplication
        if (!isset($settings["safebrowsing"]["key"]) || !$settings["safebrowsing"]["key"]) {
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...
47
            throw new SafeBrowsingException('Empty Safe Browsing key');
48
        }
49
50
        if (isset($_GET['url']) && $_GET['url']) {
51
            $url = $_GET['url'];
52
53
            $key = $settings["safebrowsing"]["key"];
54
55
            $safeBrowsing = new SafeBrowsingClient($key);
56
57
            /**
58
             * Using "gethash" request
59
             */
60
            if ($safeBrowsing->searchUrl($url)) {
61
                ?>
62
                <div class="alert alert-danger">Найден полный хеш для "<?= htmlentities($url) ?>" в списке опасных сайтов</div>
63
            <?php
64
            } else {
65
                ?>
66
                <div class="alert alert-success"><?= htmlentities($url) ?> - не найден в списке опасных сайтов</div>
67
            <?php
68
            }
69
        }
70
        ?>
71
72
        <form method="get">
73
            <div class="input-group">
74
                <input name="url" placeholder="URL" type="text" class="form-control"/>
75
                <span class="input-group-btn">
76
                    <input class="btn btn-primary" type="submit" value="Проверить URL"/>
77
                </span>
78
            </div>
79
        </form>
80
        <p>
81
            Пример: http://www.wmconvirus.narod.ru/
82
        </p>
83
        <div>
84
            Также можно посмотреть примеры:
85
            <ul>
86
                <li>
87
                    <a href="lookup.php">Lookup API и Check Adult API</a>
88
                </li>
89
                <li>
90
                    <a href="local-search.php">Поиск префикса хеша сайта в локальной БД</a>
91
                </li>
92
                <li>
93
                    <a href="save-prefixes-db.php">Сохранение базы префиксов хешей вредоносных сайтов (начнется
94
                        автоматически)</a>
95
                </li>
96
                <li>
97
                    <a href="update-prefixes-db.php">Обновить локальную базу префиксов хешей вредоносных сайтов (начнется
98
                        автоматически)</a>
99
                </li>
100
            </ul>
101
        </div>
102
    <?php
103
    } catch (SafeBrowsingException $e) {
104
        echo "Safe Browsing Exception:<br/>";
105
        echo nl2br($e->getMessage());
106
    } catch (YandexException $e) {
107
        echo "Yandex Library Exception:<br/>";
108
        echo nl2br($e->getMessage());
109
    } catch (\Exception $e) {
110
        echo get_class($e) . "<br/>";
111
        echo nl2br($e->getMessage());
112
    }
113
    ?>
114
</div>
115
116
</body>
117
</html>
118