Skip to content

idor check #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/API_Fuzzer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
require 'API_Fuzzer/request'
require 'API_Fuzzer/engine'
require 'API_Fuzzer/xxe_check'
require 'API_Fuzzer/redirect_check'
require 'API_Fuzzer/idor_check'

module API_Fuzzer
# Scans all the checks
Expand All @@ -18,6 +20,8 @@ def self.scan(options = {})
vulnerabilities << API_Fuzzer::XssCheck.scan(options)
vulnerabilities << API_Fuzzer::SqlCheck.scan(options)
vulnerabilities << API_Fuzzer::SqlBlindCheck.scan(options)
vulnerabilities << API_Fuzzer::RedirectCheck.scan(options)
vulnerabilities << API_Fuzzer::IdorCheck.scan(options)
API_Fuzzer::XxeCheck.scan(options)
vulnerabilities.uniq.flatten
end
Expand Down
47 changes: 47 additions & 0 deletions lib/API_Fuzzer/idor_check.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
require 'API_Fuzzer/vulnerability'
require 'API_Fuzzer/error'
require 'API_Fuzzer/request'

module API_Fuzzer
class IdorCheck
class << self
def scan(options = {})
@url = options[:url]
@params = options[:params]
@methods = options[:method]
@cookies = options[:cookies]
@vulnerabilities = []

fuzz_without_session
@vulnerabilities.uniq { |vuln| vuln.description }
end

def fuzz_without_session
@methods.each do |method|
response = API_Fuzzer::Request.send_api_request(
url: @url,
params: @params,
method: method,
cookies: @cookies
)

response_without_session = API_Fuzzer::Request.send_api_request(
url: @url,
params: @params,
method: method
)

fuzz_match(response, response_without_session, method)
end
end

def fuzz_match(resp, resp_without_session, method)
@vulnerabilities << API_Fuzzer::Vulnerability.new(
type: 'HIGH',
value: "API doesn't have session protection",
description: "Possible IDOR in #{method} #{@url}"
) if resp.body.to_s == resp_without_session.body.to_s
end
end
end
end