11
11
12
12
// SECURITY NOTICES AND QUERIES
13
13
//
14
- $ _securityNotices =array (
15
- 'APPSEC-1034 ' => array (
16
- 'text ' => 'addressing bypassing custom admin URL ' ,
17
- 'exec ' => array (
18
- 'path ' => array (
19
- $ _magentoPath . 'app/code/* '
20
- ),
21
- 'cmd ' => 'grep -irl ' ,
22
- 'query ' => array (
23
- '"<use>admin</use>" '
14
+ $ _securityPatches =array (
15
+ 'SUPEE-6788 ' => array
16
+ (
17
+ 'APPSEC-1034 ' => array (
18
+ 'text ' => 'addressing bypassing custom admin URL ' ,
19
+ 'exec ' => array (
20
+ 'path ' => array (
21
+ $ _magentoPath . 'app/code/* '
22
+ ),
23
+ 'cmd ' => 'grep -irl ' ,
24
+ 'query ' => array (
25
+ '"<use>admin</use>" '
26
+ )
27
+ ),
28
+ 'magentopath ' => $ _magentoPath ),
29
+ 'APPSEC-1063 ' => array (
30
+ 'text ' => 'addressing possible SQL injection ' ,
31
+ 'exec ' => array (
32
+ 'path ' => array (
33
+ $ _magentoPath . 'app/code/community/* ' ,
34
+ $ _magentoPath . 'app/code/local/* '
35
+ ),
36
+ 'cmd ' => 'grep -irl ' ,
37
+ 'query ' => array (
38
+ '"collection->addFieldToFilter( \'" ' ,
39
+ '"collection->addFieldToFilter( \'\`" ' ,
24
40
)
25
- ),
26
- 'magentopath ' => $ _magentoPath ),
27
- 'APPSEC-1063 ' => array (
28
- 'text ' => 'addressing possible SQL injection ' ,
29
- 'exec ' => array (
30
- 'path ' => array (
31
- $ _magentoPath . 'app/code/community/* ' ,
32
- $ _magentoPath . 'app/code/local/* '
33
- ),
34
- 'cmd ' => 'grep -irl ' ,
35
- 'query ' => array (
36
- '"collection->addFieldToFilter( \'" ' ,
37
- '"collection->addFieldToFilter( \'\`" ' ,
38
- )
39
- ),
40
- 'magentopath ' => $ _magentoPath ),
41
- 'APPSEC-1057 ' => array (
42
- 'text ' => 'template processing method allows access to private information ' ,
43
- 'exec ' => array (
44
- 'path ' => array (
45
- $ _magentoPath . 'app/code/community/* ' ,
46
- $ _magentoPath . 'app/code/local/* ' ,
47
- $ _magentoPath . 'app/locale/* ' ,
48
- $ _magentoPath . 'app/design/frontend/* '
49
- ),
50
- 'cmd ' => 'grep -irl ' ,
51
- 'query ' => array (
52
- '"{{config path=" ' ,
53
- '"{{block type=" ' ,
54
- )
55
- ),
56
- 'magentopath ' => $ _magentoPath )
41
+ ),
42
+ 'magentopath ' => $ _magentoPath ),
43
+ 'APPSEC-1057 ' => array (
44
+ 'text ' => 'template processing method allows access to private information ' ,
45
+ 'exec ' => array (
46
+ 'path ' => array (
47
+ $ _magentoPath . 'app/code/community/* ' ,
48
+ $ _magentoPath . 'app/code/local/* ' ,
49
+ $ _magentoPath . 'app/locale/* ' ,
50
+ $ _magentoPath . 'app/design/frontend/* '
51
+ ),
52
+ 'cmd ' => 'grep -irl ' ,
53
+ 'query ' => array (
54
+ '"{{config path=" ' ,
55
+ '"{{block type=" ' ,
56
+ )
57
+ ),
58
+ 'magentopath ' => $ _magentoPath )
59
+ )
57
60
);
58
61
59
62
// EXEC
60
63
//
61
64
echo '*** ' . "\033[1;32m " . 'Magento security file check ' . "\033[0m " . ' *** ' . "\n" ;
62
65
$ _count =1 ;
63
66
64
- foreach ($ _securityNotices as $ _name => $ _securityNotice )
67
+ foreach ($ _securityPatches as $ _patchName => $ _securityNotices )
65
68
{
69
+ echo $ _patchName . "\n" ;
70
+ $ _total =0 ;
71
+
72
+ foreach ($ _securityNotices as $ _appsec => $ _securityNotice )
73
+ {
66
74
67
- echo '[ ' . $ _count ++. '] ' . $ _name . ', ' . $ _securityNotice ['text ' ]. "\n" ;
68
- echo doExec ($ _securityNotice ,$ _name )."\n\n" ;
75
+ echo '[ ' . $ _count ++. '] ' . $ _appsec . ', ' . $ _securityNotice ['text ' ]. "\n" ;
76
+
77
+ $ _result =doExec ($ _securityNotice ,$ _appsec );
78
+ $ _total =$ _total + $ _result ['total ' ];
79
+
80
+ echo $ _result ['text ' ]. "\n" ;
69
81
82
+ }
83
+
84
+ echo $ _patchName . ' ' . ($ _total > 0 ? "\033[1;31m " . $ _total . "\033[0m " . ' affected files. ' : $ _total . 'affected files. ' ). "\n" ;
70
85
}
71
86
72
87
echo '*********************************** ' . "\n" ;
73
88
exit ;
74
89
75
90
76
- function doExec ($ _securityNotice ,$ _name )
91
+ function doExec ($ _securityNotice ,$ _appsec )
77
92
{
78
93
$ _text ='' ;
79
94
$ _exec =$ _securityNotice ['exec ' ]['cmd ' ];
95
+ $ _total =0 ;
80
96
81
97
foreach ($ _securityNotice ['exec ' ]['path ' ] as $ _searchPath )
82
98
{
@@ -100,10 +116,11 @@ function doExec($_securityNotice,$_name)
100
116
if (0 === $ _status )
101
117
{
102
118
$ _count =$ _count + count ($ _output );
119
+ $ _total =$ _total + $ _count ;
103
120
104
121
foreach ($ _output as $ _line )
105
122
{
106
- $ _search =$ _search .'[ ' . "\033[1;32m " . $ _name . "\033[0m " . '] ' . $ _searchQuery . ' found in ' . "\033[1;31m " . str_replace ($ _securityNotice ['magentopath ' ],' ' , $ _line ). "\033[0m \n" ;
123
+ $ _search =$ _search .'[ ' . "\033[1;32m " . $ _appsec . "\033[0m " . '] ' . $ _searchQuery . ' found in ' . "\033[1;31m " . str_replace ($ _securityNotice ['magentopath ' ],' ' , $ _line ). "\033[0m \n" ;
107
124
}
108
125
109
126
} else {
@@ -115,6 +132,9 @@ function doExec($_securityNotice,$_name)
115
132
$ _text =$ _text .($ _count > 0 ? "\033[1;31m " . $ _count . "\033[0m " . ' affected files : ' : $ _count . 'affected files. ' ). "\n" . $ _search . "\n" ;
116
133
}
117
134
118
- return $ _text ;
135
+ return array (
136
+ 'text ' => $ _text ,
137
+ 'total ' => $ _total
138
+ );
119
139
120
140
}
0 commit comments