@@ -11,7 +11,7 @@ describe WpPlugins do
|
||||
let(:expected) do
|
||||
{
|
||||
request_params: { cache_ttl: 0, followlocation: true },
|
||||
vulns_file: PLUGINS_VULNS_FILE,
|
||||
vulns_file: PLUGINS_FILE,
|
||||
targets_items_from_file: [ WpPlugin.new(uri, name: 'plugin1'),
|
||||
WpPlugin.new(uri, name:'plugin-2'),
|
||||
WpPlugin.new(uri, name: 'mr-smith')],
|
||||
|
||||
@@ -13,7 +13,7 @@ describe WpThemes do
|
||||
let(:expected) do
|
||||
{
|
||||
request_params: { cache_ttl: 0, followlocation: true },
|
||||
vulns_file: THEMES_VULNS_FILE,
|
||||
vulns_file: THEMES_FILE,
|
||||
targets_items_from_file: [ WpTheme.new(uri, name: '3colours'),
|
||||
WpTheme.new(uri, name:'42k'),
|
||||
WpTheme.new(uri, name: 'a-ri')],
|
||||
|
||||
@@ -11,11 +11,11 @@ describe WpItem do
|
||||
end
|
||||
it_behaves_like 'WpItem::Versionable'
|
||||
it_behaves_like 'WpItem::Vulnerable' do
|
||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_item/vulnerable/items_vulns.json' }
|
||||
let(:db_file) { MODELS_FIXTURES + '/wp_item/vulnerable/items_vulns.json' }
|
||||
let(:identifier) { 'neo' }
|
||||
let(:expected_refs) { {
|
||||
'id' => [2993],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'url' => ['Ref 1', 'Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'secunia' => ['secunia'],
|
||||
'osvdb' => ['osvdb'],
|
||||
|
||||
@@ -5,11 +5,11 @@ require 'spec_helper'
|
||||
describe WpPlugin do
|
||||
it_behaves_like 'WpPlugin::Vulnerable'
|
||||
it_behaves_like 'WpItem::Vulnerable' do
|
||||
let(:options) { { name: 'white-rabbit' } }
|
||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins_vulns.json' }
|
||||
let(:options) { { name: 'white-rabbit' } }
|
||||
let(:db_file) { MODELS_FIXTURES + '/wp_plugin/vulnerable/plugins.json' }
|
||||
let(:expected_refs) { {
|
||||
'id' => [2993],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'url' => ['Ref 1', 'Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'secunia' => ['secunia'],
|
||||
'osvdb' => ['osvdb'],
|
||||
|
||||
@@ -7,10 +7,10 @@ describe WpTheme do
|
||||
it_behaves_like 'WpTheme::Vulnerable'
|
||||
it_behaves_like 'WpItem::Vulnerable' do
|
||||
let(:options) { { name: 'the-oracle' } }
|
||||
let(:vulns_file) { MODELS_FIXTURES + '/wp_theme/vulnerable/themes_vulns.json' }
|
||||
let(:db_file) { MODELS_FIXTURES + '/wp_theme/vulnerable/themes_vulns.json' }
|
||||
let(:expected_refs) { {
|
||||
'id' => [2993],
|
||||
'url' => ['Ref 1,Ref 2'],
|
||||
'url' => ['Ref 1', 'Ref 2'],
|
||||
'cve' => ['2011-001'],
|
||||
'secunia' => ['secunia'],
|
||||
'osvdb' => ['osvdb'],
|
||||
|
||||
@@ -121,4 +121,122 @@ describe 'VersionCompare' do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe '::lesser?' do
|
||||
context 'version checked is newer' do
|
||||
after { expect(VersionCompare::lesser?(@version1, @version2)).to be_truthy }
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '1.0'
|
||||
@version2 = '2.0'
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '1.0'
|
||||
@version2 = '1.1'
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '1.0a'
|
||||
@version2 = '1.0b'
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '1.0'
|
||||
@version2 = '5000000'
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '0'
|
||||
@version2 = '1'
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '0.4.2b'
|
||||
@version2 = '2.3.3'
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '.47'
|
||||
@version2 = '.50.3'
|
||||
end
|
||||
end
|
||||
|
||||
context 'version checked is older' do
|
||||
after { expect(VersionCompare::lesser?(@version1, @version2)).to be_falsey }
|
||||
|
||||
it 'returns false' do
|
||||
@version1 = '1'
|
||||
@version2 = '0'
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
@version1 = '1.0'
|
||||
@version2 = '0.5'
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
@version1 = '500000'
|
||||
@version2 = '1'
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
@version1 = '1.6.3.7.3.4'
|
||||
@version2 = '1.2.4.567.679.8.e'
|
||||
end
|
||||
|
||||
it 'returns false' do
|
||||
@version1 = '.47'
|
||||
@version2 = '.46.3'
|
||||
end
|
||||
end
|
||||
|
||||
context 'version checked is the same' do
|
||||
after { expect(VersionCompare::lesser?(@version1, @version2)).to be_falsey }
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = '1'
|
||||
@version2 = '1'
|
||||
end
|
||||
|
||||
it 'returns true' do
|
||||
@version1 = 'a'
|
||||
@version2 = 'a'
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'version number causes Gem::Version new Exception' do
|
||||
after { expect(VersionCompare::lesser?(@version1, @version2)).to be_falsey }
|
||||
|
||||
it 'returns false' do
|
||||
@version1 = 'a'
|
||||
@version2 = 'b'
|
||||
end
|
||||
end
|
||||
|
||||
context 'one version number is not set' do
|
||||
after { expect(VersionCompare::lesser?(@version1, @version2)).to be_falsey }
|
||||
|
||||
it 'returns false (version2 nil)' do
|
||||
@version1 = '1'
|
||||
@version2 = nil
|
||||
end
|
||||
|
||||
it 'returns false (version1 nil)' do
|
||||
@version1 = nil
|
||||
@version2 = '1'
|
||||
end
|
||||
|
||||
it 'returns false (version2 empty)' do
|
||||
@version1 = '1'
|
||||
@version2 = ''
|
||||
end
|
||||
|
||||
it 'returns false (version1 empty)' do
|
||||
@version1 = ''
|
||||
@version2 = '1'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,58 +1,64 @@
|
||||
[
|
||||
{
|
||||
"mr-smith":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"references":"https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
{
|
||||
"mr-smith": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"references": {
|
||||
"url": "https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com"
|
||||
},
|
||||
{
|
||||
"id":2990,
|
||||
"title":"Potential Authentication Cookie Forgery",
|
||||
"references":"https://labs.mwrinfosecurity.com/blog/2014/04/11/wordpress-auth-cookie-forgery/,https://github.com/WordPress/WordPress/commit/78a915e0e5927cf413aa6c2cef2fca3dc587f8be",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
},
|
||||
{
|
||||
"id":2990,
|
||||
"title":"Potential Authentication Cookie Forgery",
|
||||
"references": {
|
||||
"url": "https://labs.mwrinfosecurity.com/blog/2014/04/11/wordpress-auth-cookie-forgery/,https://github.com/WordPress/WordPress/commit/78a915e0e5927cf413aa6c2cef2fca3dc587f8be",
|
||||
"osvdb":"105620",
|
||||
"cve":"2014-0166",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
"cve":"2014-0166"
|
||||
},
|
||||
{
|
||||
"id":2991,
|
||||
"title":"Privilege escalation: contributors publishing posts",
|
||||
"references":"https://github.com/wpscanteam/wpscan/wiki/CVE-2014-0165",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
},
|
||||
{
|
||||
"id":2991,
|
||||
"title":"Privilege escalation: contributors publishing posts",
|
||||
"references": {
|
||||
"url": "https://github.com/wpscanteam/wpscan/wiki/CVE-2014-0165",
|
||||
"osvdb":"105630",
|
||||
"cve":"2014-0165",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
"cve":"2014-0165"
|
||||
},
|
||||
{
|
||||
"id":2992,
|
||||
"title":"Plupload Unspecified XSS",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
},
|
||||
{
|
||||
"id":2992,
|
||||
"title":"Plupload Unspecified XSS",
|
||||
"references": {
|
||||
"osvdb":"105622",
|
||||
"secunia":"57769",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
}
|
||||
]
|
||||
}
|
||||
"secunia":"57769"
|
||||
},
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"neo":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"wp-admin/options-writing.php Cleartext Admin Credentials Disclosure",
|
||||
"references":"http://seclists.org/fulldisclosure/2013/Dec/135",
|
||||
"osvdb":"101101",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
"neo": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"wp-admin/options-writing.php Cleartext Admin Credentials Disclosure",
|
||||
"references": {
|
||||
"url": "http://seclists.org/fulldisclosure/2013/Dec/135",
|
||||
"osvdb":"101101"
|
||||
},
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,58 +1,64 @@
|
||||
[
|
||||
{
|
||||
"mr-smith":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"references":"https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
{
|
||||
"mr-smith": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"references": {
|
||||
"url": "https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com"
|
||||
},
|
||||
{
|
||||
"id":2990,
|
||||
"title":"Potential Authentication Cookie Forgery",
|
||||
"references":"https://labs.mwrinfosecurity.com/blog/2014/04/11/wordpress-auth-cookie-forgery/,https://github.com/WordPress/WordPress/commit/78a915e0e5927cf413aa6c2cef2fca3dc587f8be",
|
||||
"osvdb":"105620",
|
||||
"cve":"2014-0166",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
},
|
||||
{
|
||||
"id":2990,
|
||||
"title":"Potential Authentication Cookie Forgery",
|
||||
"references": {
|
||||
"url": "https://labs.mwrinfosecurity.com/blog/2014/04/11/wordpress-auth-cookie-forgery/,https://github.com/WordPress/WordPress/commit/78a915e0e5927cf413aa6c2cef2fca3dc587f8be"
|
||||
},
|
||||
{
|
||||
"id":2991,
|
||||
"title":"Privilege escalation: contributors publishing posts",
|
||||
"references":"https://github.com/wpscanteam/wpscan/wiki/CVE-2014-0165",
|
||||
"osvdb":"105620",
|
||||
"cve":"2014-0166",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
},
|
||||
{
|
||||
"id":2991,
|
||||
"title":"Privilege escalation: contributors publishing posts",
|
||||
"references": {
|
||||
"url": "https://github.com/wpscanteam/wpscan/wiki/CVE-2014-0165",
|
||||
"osvdb":"105630",
|
||||
"cve":"2014-0165",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
"cve":"2014-0165"
|
||||
},
|
||||
{
|
||||
"id":2992,
|
||||
"title":"Plupload Unspecified XSS",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
},
|
||||
{
|
||||
"id":2992,
|
||||
"title":"Plupload Unspecified XSS",
|
||||
"references": {
|
||||
"osvdb":"105622",
|
||||
"secunia":"57769",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
}
|
||||
]
|
||||
}
|
||||
"secunia":"57769"
|
||||
},
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"neo":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"wp-admin/options-writing.php Cleartext Admin Credentials Disclosure",
|
||||
"references":"http://seclists.org/fulldisclosure/2013/Dec/135",
|
||||
"osvdb":"101101",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
"neo": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"wp-admin/options-writing.php Cleartext Admin Credentials Disclosure",
|
||||
"references": {
|
||||
"url": "http://seclists.org/fulldisclosure/2013/Dec/135",
|
||||
"osvdb":"101101"
|
||||
},
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,58 +1,65 @@
|
||||
[
|
||||
{
|
||||
"shopperpress":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"references":"https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
{
|
||||
"shopperpress": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"references": {
|
||||
"url": "https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com"
|
||||
},
|
||||
{
|
||||
"id":2990,
|
||||
"title":"Potential Authentication Cookie Forgery",
|
||||
"references":"https://labs.mwrinfosecurity.com/blog/2014/04/11/wordpress-auth-cookie-forgery/,https://github.com/WordPress/WordPress/commit/78a915e0e5927cf413aa6c2cef2fca3dc587f8be",
|
||||
"osvdb":"105620",
|
||||
"cve":"2014-0166",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
},
|
||||
{
|
||||
"id":2990,
|
||||
"title":"Potential Authentication Cookie Forgery",
|
||||
"references": {
|
||||
"url": "https://labs.mwrinfosecurity.com/blog/2014/04/11/wordpress-auth-cookie-forgery/,https://github.com/WordPress/WordPress/commit/78a915e0e5927cf413aa6c2cef2fca3dc587f8be",
|
||||
"osvdb":"105620",
|
||||
"cve":"2014-0166"
|
||||
},
|
||||
{
|
||||
"id":2991,
|
||||
"title":"Privilege escalation: contributors publishing posts",
|
||||
"references":"https://github.com/wpscanteam/wpscan/wiki/CVE-2014-0165",
|
||||
"osvdb":"105630",
|
||||
"cve":"2014-0165",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
},
|
||||
{
|
||||
"id":2991,
|
||||
"title":"Privilege escalation: contributors publishing posts",
|
||||
"references": {
|
||||
"url": "https://github.com/wpscanteam/wpscan/wiki/CVE-2014-0165",
|
||||
"osvdb":"105630",
|
||||
"cve":"2014-0165"
|
||||
},
|
||||
{
|
||||
"id":2992,
|
||||
"title":"Plupload Unspecified XSS",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
},
|
||||
{
|
||||
"id":2992,
|
||||
"title":"Plupload Unspecified XSS",
|
||||
"references": {
|
||||
"osvdb":"105622",
|
||||
"secunia":"57769",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
}
|
||||
]
|
||||
}
|
||||
"secunia":"57769"
|
||||
},
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z",
|
||||
"fixed_in":"3.8.2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"webfolio":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"wp-admin/options-writing.php Cleartext Admin Credentials Disclosure",
|
||||
"references":"http://seclists.org/fulldisclosure/2013/Dec/135",
|
||||
"osvdb":"101101",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
"webfolio": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"wp-admin/options-writing.php Cleartext Admin Credentials Disclosure",
|
||||
"references": {
|
||||
"url": "http://seclists.org/fulldisclosure/2013/Dec/135",
|
||||
"osvdb":"101101"
|
||||
},
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
{
|
||||
"id": "3911",
|
||||
"title": "Vuln Title",
|
||||
"url": "Ref 1,Ref 2",
|
||||
"secunia": "secunia",
|
||||
"osvdb": "osvdb",
|
||||
"cve": "2011-001",
|
||||
"metasploit": "exploit/ex1",
|
||||
"exploitdb": "exploitdb",
|
||||
"references":{
|
||||
"url": "Ref 1,Ref 2",
|
||||
"secunia": "secunia",
|
||||
"osvdb": "osvdb",
|
||||
"cve": "2011-001",
|
||||
"metasploit": "exploit/ex1",
|
||||
"exploitdb": "exploitdb"
|
||||
},
|
||||
"created_at": "2014-07-28T12:10:45.000Z",
|
||||
"updated_at": "2014-07-28T12:10:45.000Z",
|
||||
"type": "CSRF",
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
[
|
||||
{
|
||||
"not-this-one":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"url":"https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/,http://www.example.com",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"not-this-one": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Administrator-exploitable blind SQLi in WordPress 1.0 - 3.8.1",
|
||||
"references": {
|
||||
"url": ["https://security.dxw.com/advisories/sqli-in-wordpress-3-6-1/" ,"http://www.example.com"]
|
||||
},
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:43:41.000Z"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"neo":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"I'm the one",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
"neo": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"I'm the one",
|
||||
"references": {
|
||||
"url": ["Ref 1", "Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
58
spec/samples/common/models/wp_plugin/vulnerable/plugins.json
Normal file
58
spec/samples/common/models/wp_plugin/vulnerable/plugins.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"mr-smith": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"I should not appear in the results",
|
||||
"references": {
|
||||
"url": ["Ref 1","Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
},
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Neither do I",
|
||||
"references": {
|
||||
"url": ["Ref 1" ,"Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
},
|
||||
"white-rabbit": {
|
||||
"vulnerabilities": [
|
||||
{
|
||||
"id":2993,
|
||||
"title":"Follow me!",
|
||||
"references": {
|
||||
"url": ["Ref 1", "Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"REDIRECT",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
[
|
||||
{
|
||||
"mr-smith":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"I should not appear in the results",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
},
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Neither do I",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"white-rabbit":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"Follow me!",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"REDIRECT",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,56 +1,59 @@
|
||||
[
|
||||
{
|
||||
"mr-smith":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"I should not appear in the results",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
{
|
||||
"mr-smith": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"I should not appear in the results",
|
||||
"references": {
|
||||
"url": ["Ref 1", "Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Neither do I",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
},
|
||||
{
|
||||
"id":2989,
|
||||
"title":"Neither do I",
|
||||
"references": {
|
||||
"url": ["Ref 1", "Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"the-oracle":{
|
||||
},
|
||||
"the-oracle": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"I see you",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"references": {
|
||||
"url": ["Ref 1", "Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"FPD",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
[
|
||||
{
|
||||
"3.5":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"I should not appear in the results",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"3.2":{
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"Here I Am",
|
||||
"url":"Ref 1,Ref 2",
|
||||
"osvdb":"osvdb",
|
||||
"cve":"2011-001",
|
||||
"secunia":"secunia",
|
||||
"metasploit":"exploit/ex1",
|
||||
"exploitdb":"exploitdb",
|
||||
"type":"SQLI",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
{
|
||||
"3.5": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2989,
|
||||
"title":"I should not appear in the results",
|
||||
"references": {
|
||||
"url": ["Ref 1", "Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"XSS",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
},
|
||||
"3.2": {
|
||||
"vulnerabilities":[
|
||||
{
|
||||
"id":2993,
|
||||
"title":"Here I Am",
|
||||
"references": {
|
||||
"url": ["Ref 1", "Ref 2"],
|
||||
"osvdb": ["osvdb"],
|
||||
"cve": ["2011-001"],
|
||||
"secunia": ["secunia"],
|
||||
"metasploit": ["exploit/ex1"],
|
||||
"exploitdb": ["exploitdb"]
|
||||
},
|
||||
"type":"SQLI",
|
||||
"fixed_in":"",
|
||||
"created_at":"2014-07-28T12:10:07.000Z",
|
||||
"updated_at":"2014-07-28T12:10:07.000Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
shared_examples 'WpItem::Vulnerable' do
|
||||
|
||||
# 2 variables have to be set in the described class or subject:
|
||||
# let(:vulns_file) { }
|
||||
# let(:expected_vulns) { } The expected Vulnerabilities when using vulns_file and vulns_xpath
|
||||
# let(:db_file) { }
|
||||
# let(:expected_vulns) { } The expected Vulnerabilities when using db_file and vulns_xpath
|
||||
#
|
||||
# 1 variable is optional, used if supplied, otherwise subject.vulns_xpath is used
|
||||
# let(:vulns_xpath) { }
|
||||
@@ -18,7 +18,7 @@ shared_examples 'WpItem::Vulnerable' do
|
||||
end
|
||||
|
||||
after do
|
||||
subject.vulns_file = @vulns_file
|
||||
subject.db_file = @db_file
|
||||
subject.identifier = identifier if defined?(identifier)
|
||||
|
||||
result = subject.vulnerabilities
|
||||
@@ -26,16 +26,16 @@ shared_examples 'WpItem::Vulnerable' do
|
||||
expect(result).to eq @expected
|
||||
end
|
||||
|
||||
context 'when the vulns_file is empty' do
|
||||
context 'when the db_file is empty' do
|
||||
it 'returns an empty Vulnerabilities' do
|
||||
@vulns_file = empty_file
|
||||
@expected = Vulnerabilities.new
|
||||
@db_file = empty_file
|
||||
@expected = Vulnerabilities.new
|
||||
end
|
||||
end
|
||||
|
||||
it 'returns the expected vulnerabilities' do
|
||||
@vulns_file = vulns_file
|
||||
@expected = expected_vulns
|
||||
@db_file = db_file
|
||||
@expected = expected_vulns
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -39,68 +39,8 @@ shared_examples 'WpItems::Detectable' do
|
||||
end
|
||||
end
|
||||
|
||||
describe '::targets_items_from_file' do
|
||||
after do
|
||||
results = subject.send(:targets_items_from_file, file, wp_target, item_class, vulns_file)
|
||||
|
||||
expect(results.map { |i| i.name }).to eq @expected.map { |i| i.name }
|
||||
|
||||
unless results.empty?
|
||||
results.each do |item|
|
||||
expect(item).to be_a item_class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# should raise error.
|
||||
# context 'when an empty file' do
|
||||
# let(:file) { empty_file }
|
||||
|
||||
# it 'returns an empty Array' do
|
||||
# @expected = []
|
||||
# end
|
||||
# end
|
||||
|
||||
context 'when a file' do
|
||||
let(:file) { targets_items_file }
|
||||
|
||||
it 'returns the expected Array of WpItem' do
|
||||
@expected = expected[:targets_items_from_file]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '::vulnerable_targets_items' do
|
||||
after do
|
||||
results = subject.send(:vulnerable_targets_items, wp_target, item_class, vulns_file)
|
||||
|
||||
expect(results.map { |i| i.name }).to eq @expected.map { |i| i.name }
|
||||
|
||||
unless results.empty?
|
||||
results.each do |item|
|
||||
expect(item).to be_a item_class
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# should raise error.
|
||||
# context 'when an empty file' do
|
||||
# let(:file) { empty_file }
|
||||
|
||||
# it 'returns an empty Array' do
|
||||
# @expected = []
|
||||
# end
|
||||
# end
|
||||
|
||||
context 'when a file' do
|
||||
it 'returns the expected Array of WpItem' do
|
||||
@expected = expected[:vulnerable_targets_items]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '::targets_items' do
|
||||
let(:options) { {} }
|
||||
let(:options) { { type: :all } }
|
||||
|
||||
after do
|
||||
if @expected
|
||||
@@ -110,29 +50,13 @@ shared_examples 'WpItems::Detectable' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when :only_vulnerable' do
|
||||
let(:options) { { only_vulnerable: true } }
|
||||
context 'when :type = :vulnerable' do
|
||||
let(:options) { { type: :vulnerable } }
|
||||
|
||||
it 'returns the expected Array of WpItem' do
|
||||
@expected = expected[:vulnerable_targets_items]
|
||||
end
|
||||
end
|
||||
|
||||
context 'when not :only_vulnerable' do
|
||||
context 'when no :file' do
|
||||
it 'raises an error' do
|
||||
expect { subject.send(:targets_items, wp_target, options) }.to raise_error('A file must be supplied')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when :file' do
|
||||
let(:options) { { file: targets_items_file } }
|
||||
|
||||
it 'returns the expected Array of WpItem' do
|
||||
@expected = (expected[:targets_items_from_file] + expected[:vulnerable_targets_items]).uniq {|t| t.name }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '::passive_detection' do
|
||||
@@ -176,8 +100,8 @@ shared_examples 'WpItems::Detectable' do
|
||||
expect(result.sort.map { |i| i.name }).to eq @expected.sort.map { |i| i.name }
|
||||
end
|
||||
|
||||
context 'when :only_vulnerable' do
|
||||
let(:options) { { only_vulnerable: true } }
|
||||
context 'when :type = :vulnerable' do
|
||||
let(:options) { { type: :vulnerable } }
|
||||
let(:targets) { expected[:vulnerable_targets_items] }
|
||||
|
||||
it 'only checks and return vulnerable targets' do
|
||||
@@ -207,7 +131,7 @@ shared_examples 'WpItems::Detectable' do
|
||||
end
|
||||
end
|
||||
|
||||
context 'when no :only_vulnerable' do
|
||||
context 'when no :type = :vulnerable' do
|
||||
let(:targets) { (expected[:vulnerable_targets_items] + expected[:targets_items_from_file]).uniq { |t| t.name } }
|
||||
|
||||
it 'checks all targets, and merge the results with passive_detection' do
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
|
||||
shared_examples 'WpPlugin::Vulnerable' do
|
||||
|
||||
describe '#vulns_file' do
|
||||
after { expect(subject.vulns_file).to eq @expected }
|
||||
describe '#db_file' do
|
||||
after { expect(subject.db_file).to eq @expected }
|
||||
|
||||
context 'when :vulns_file is no set' do
|
||||
context 'when :db_file is no set' do
|
||||
it 'returns the default one' do
|
||||
@expected = PLUGINS_VULNS_FILE
|
||||
@expected = PLUGINS_FILE
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the :vulns_file is already set' do
|
||||
context 'when the :db_file is already set' do
|
||||
it 'returns it' do
|
||||
@expected = 'test.json'
|
||||
subject.vulns_file = @expected
|
||||
@expected = 'test.json'
|
||||
subject.db_file = @expected
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#identifier' do
|
||||
its(:identifier) { is_expected.to eq 'plugin-name' }
|
||||
its(:identifier) { should eq 'plugin-name' }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
|
||||
shared_examples 'WpTheme::Vulnerable' do
|
||||
|
||||
describe '#vulns_file' do
|
||||
after { expect(subject.vulns_file).to eq @expected }
|
||||
describe '#db_file' do
|
||||
after { expect(subject.db_file).to eq @expected }
|
||||
|
||||
context 'when :vulns_file is not set' do
|
||||
context 'when :db_file is not set' do
|
||||
it 'returns the default one' do
|
||||
@expected = THEMES_VULNS_FILE
|
||||
@expected = THEMES_FILE
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the :vulns_file is already set' do
|
||||
context 'when the :db_file is already set' do
|
||||
it 'returns it' do
|
||||
@expected = 'test.json'
|
||||
subject.vulns_file = @expected
|
||||
@expected = 'test.json'
|
||||
subject.db_file = @expected
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#identifier' do
|
||||
its(:identifier) { is_expected.to eq 'theme-name' }
|
||||
its(:identifier) { should eq 'theme-name' }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -2,25 +2,25 @@
|
||||
|
||||
shared_examples 'WpVersion::Vulnerable' do
|
||||
|
||||
describe '#vulns_file' do
|
||||
after { expect(subject.vulns_file).to eq @expected }
|
||||
describe '#db_file' do
|
||||
after { expect(subject.db_file).to eq @expected }
|
||||
|
||||
context 'when :vulns_file is no set' do
|
||||
context 'when :db_file is no set' do
|
||||
it 'returns the default one' do
|
||||
@expected = WP_VULNS_FILE
|
||||
@expected = WORDPRESSES_FILE
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the :vulns_file is already set' do
|
||||
context 'when the :db_file is already set' do
|
||||
it 'returns it' do
|
||||
@expected = 'test.json'
|
||||
subject.vulns_file = @expected
|
||||
@expected = 'test.json'
|
||||
subject.db_file = @expected
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#identifier' do
|
||||
its(:identifier) { is_expected.to eq '1.2' }
|
||||
its(:identifier) { should eq '1.2' }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user