Crash occurs when doing recursive scan against a directory that is denied access by AppArmor
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start with utils/string_reader.go at StringArrayReader.ReadString and utils/do.go at Coordinator.DoWithStringsFromReader, then reproduce the AppArmor-denied recursive scan using the commands in the issue. Trace how the denied directory is reported through the reader and coordinator. Done means vt scan file -r ~/denied-dir reports the access problem without panicking.
Written by the indexing model from the issue text.
Description
Steps to reproduce
-
Launch an Ubuntu VM (I use this Vagrant-based VM implementation).
-
Install
vtto /usr/local/bin as root. -
Setting up an API key.
-
Run the following command to create a directory to be denied by AppArmor:
mkdir -p ~/denied-dir -
Create the
/etc/apparmor.d/usr.local.bin.vtApparmor profile file as root with the following content:abi <abi/3.0>, include <tunables/global> /usr/local/bin/vt { include <abstractions/base> include <abstractions/nameservice> include <abstractions/ssl_certs> /home/*/** r, deny owner /home/*/denied-dir/ r, /etc/hosts r, /etc/nsswitch.conf r, /run/systemd/resolve/stub-resolv.conf r, /usr/local/bin/vt mr, owner /home/*/.cache/.vt.relationships.cache rw, owner /home/*/.vt.toml rw, } -
Run the following command as root to load the AppArmor profile in enforcing mode:
apparmor_parser -r /etc/apparmor.d/usr.local.bin.vt -
Run the following command to trigger the crash:
vt scan file -r ~/denied-dir
Current behavior
The program crashed with:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x82be08]
goroutine 7 [running]:
github.com/VirusTotal/vt-cli/utils.(*StringArrayReader).ReadString(0x0?)
/home/runner/work/vt-cli/vt-cli/utils/string_reader.go:46 +0x8
github.com/VirusTotal/vt-cli/utils.(*Coordinator).DoWithStringsFromReader.func1()
/home/runner/work/vt-cli/vt-cli/utils/do.go:69 +0x2f
created by github.com/VirusTotal/vt-cli/utils.(*Coordinator).DoWithStringsFromReader in goroutine 1
/home/runner/work/vt-cli/vt-cli/utils/do.go:68 +0x95
Expected behavior
No crash
Version
1.3.0
- Dominant language
- Go
- Stars
- 1.5k
- Forks
- 147
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from VirusTotal/vt-cli
-
Bulk URL Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
VirusTotal/vt-cli#135 ·
-
Virustotal/vr-cli Open
Difficulty 5/5 Over a week Newbie friendliness 10/100
VirusTotal/vt-cli#142 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
VirusTotal/vt-cli#128 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
VirusTotal/vt-cli#118 · 1 comment · 4 reactions ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
VirusTotal/vt-cli#112 · 2 comments · 2 reactions ·
All issues in VirusTotal/vt-cli
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 84/100
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
sympozium-ai/sympozium#627 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100