10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/tainted_love/replacer/replace_action_controller.rb', line 10
def replace!
TaintedLove.proxy_method('ActionController::Instrumentation', :send_file) do |_, *args|
TaintedLove.report(
:ReplaceActionController,
args.first,
[:lfi],
'Sendfile using tainted file name'
) if args.first.tainted?
end
TaintedLove.proxy_method('ActionController::Instrumentation', :render) do |_, *args|
unless args.empty?
f = args.first
if f.is_a?(Hash)
if f.key?(:inline) && f[:inline].tainted?
TaintedLove.report(
:ReplaceActionController,
f[:inline],
[:rce],
'render(inline:) using tainted string'
)
end
if f.key?(:file) && f[:file].tainted?
TaintedLove.report(
:ReplaceActionController,
f[:file],
[:lfi],
'render(file:) using tainted file name'
)
end
end
if f.is_a?(String) && f.tainted?
TaintedLove.report(
:ReplaceActionController,
f,
[:lfi],
'render using tainted template name'
)
end
end
end
end
|