Author: Sean 韋詠祥
Slide: https://tg.pe/sdy
Path Traversal / CVE-2021-43798
CVSS Score: 7.5 (High)
Please refer to "grafana/grafana@c798c0e
".
It's not safe to use "filepath.Join
" for user input.
Rel
"?func Rel(basepath, targpath)
/* Join(basepath, Rel(basepath, targpath)) == targpath */
Returns a relative path that is equivalent to targpath
when joined to basepath
with an /
.
Return error if targpath
can't be made relative to basepath
.
Check if it's relative path before
Get "/flag
" using skill you learn.
Hint: Use "curl --path-as-is
" to preserve "../
" path.
Path Traversal / CVE-2021-41773
CVSS Score: 7.5 (High)
We could use "%2e
" or "%2E
" to exploit it.
The flag is located in "/flag
" file.
Path Traversal / CVE-2021-42013
CVSS Score: 9.8 (Critical)
Let's review previous security patch.
Assert "%
" will follow by two "[0-9a-f]
" char.
Use "%%32%65
" to double encode.
Command Injection / CVE-2021-32682
CVSS Score: 9.8 (Critical)
zip
command$ zip -r9 -q 'target.zip' './source.txt'
-q, --quiet
Quiet mode; eliminate informational messages and
comment prompts. (Useful, for example, in shell
scripts and background tasks).
-r, --recurse-paths
Travel the directory structure recursively;
for example: `zip -r archive.zip folder/`
-# (-0, -1, -2, -3, -4, -5, -6, -7, -8, -9)
The speed of compression.
-0 means no compression.
-1 indicates the fastest compression speed.
-9 uses the optimal compression.
-v, --verbose
Verbose mode or print diagnostic version info.
-T, --test
Test the integrity of the new zip file.
-TT, --unzip-command
Use custom command to test an archive
when the -T option is used.
Add ./
before filename.
We could leverage zip -TT
option.
$ zip -T -TT 'echo' file.zip
Hint: File name could be "-v hello.zip
".
Any questions?
JNDI Injection / CVE-2021-44228
CVSS Score: 10.0 (Critical)
Homework: http://sqlab.nycu.dev:44228/
Fix Commit: apache/logging-log4j2@c77b3cb