Module: PWN::SAST::PaddingOracle

Defined in:
lib/pwn/sast/padding_oracle.rb

Overview

SAST Module used to identify padding oracle vulnerabilities involving weak CBC block cipher padding.

Class Method Summary collapse

Class Method Details

.authorsObject

Author(s)

0day Inc. <[email protected]>



52
53
54
55
56
# File 'lib/pwn/sast/padding_oracle.rb', line 52

public_class_method def self.authors
  "AUTHOR(S):
    0day Inc. <[email protected]>
  "
end

.helpObject

Display Usage for this Module



60
61
62
63
64
65
66
67
68
69
# File 'lib/pwn/sast/padding_oracle.rb', line 60

public_class_method def self.help
  puts "USAGE:
    sast_arr = #{self}.scan(
      dir_path: 'optional path to dir defaults to .',
      git_repo_root_uri: 'optional http uri of git repo scanned'
    )

    #{self}.authors
  "
end

.scan(opts = {}) ⇒ Object

Supported Method Parameters

PWN::SAST::PaddingOracle.scan(

dir_path: 'optional path to dir defaults to .'
git_repo_root_uri: 'optional http uri of git repo scanned'

)



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pwn/sast/padding_oracle.rb', line 16

public_class_method def self.scan(opts = {})
  dir_path = opts[:dir_path]
  git_repo_root_uri = opts[:git_repo_root_uri].to_s.scrub

  # TODO: Include regex to search for weak CBC block cipher padding
  test_case_filter = "
    grep -Ein \
    -e 'AES/CBC/PKCS' {PWN_SAST_SRC_TARGET} 2> /dev/null
  "

  PWN::SAST::TestCaseEngine.execute(
    test_case_filter: test_case_filter,
    security_references: security_references,
    dir_path: dir_path,
    git_repo_root_uri: git_repo_root_uri
  )
rescue StandardError => e
  raise e
end

.security_referencesObject

Used to dictate Security Control Requirements for a Given SAST module.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/pwn/sast/padding_oracle.rb', line 38

public_class_method def self.security_references
  {
    sast_module: self,
    section: 'PUBLIC KEY INFRASTRUCTURE CERTIFICATES',
    nist_800_53_uri: 'https://csrc.nist.gov/projects/cprt/catalog#/cprt/framework/version/SP_800_53_5_1_1/home?element=SC-17',
    cwe_id: '310',
    cwe_uri: 'https://cwe.mitre.org/data/definitions/310.html'
  }
rescue StandardError => e
  raise e
end