Skip to content

fix(scanner/windows): allow only cab file scan for offline scan #2236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Jun 6, 2025

If this Pull Request is work in progress, Add a prefix of “[WIP]” in the title.

What did you implement:

Even though an offline scan was specified, depending on the ServerSelection, the scanner would still connect to Windows Update or Windows Server Update Services (WSUS) server.
To ensure that this is a strictly offline scan, offline scans do not access Windows Update or WSUS server.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

setup

$ cat << EOS > config.toml
version = "v2"

[default]

[servers]

[server.windows]
host = "127.0.0.1"
port = "2222"
user = "vagrant"
keyPath = "/home/vuls/vuls-targets-docker/.ssh/id_rsa"
scanMode           = ["fast", "offline"]
scanModules        = ["ospkg"]

[servers.windows.windows]
serverSelection = 1
EOS

before

$ vuls scan -debug 2>&1 | grep "UpdateSearcher.search"
time="Jun  9 12:20:30" level=debug msg="Executing... powershell.exe -NoProfile -NonInteractive \"$UpdateSession = (New-Object -ComObject Microsoft.Update.Session); $UpdateSearcher = $UpdateSession.CreateUpdateSearcher(); $UpdateSearcher.ServerSelection = 1; $UpdateSearcher.search(\\\"IsInstalled = 1 and RebootRequired = 0 and Type='Software'\\\").Updates | ForEach-Object -MemberName KBArticleIDs\""
...

after

$ vuls scan -debug 2>&1 | grep "UpdateSearcher.search"
(empty)

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n self-assigned this Jun 6, 2025
@MaineK00n MaineK00n force-pushed the MaineK00n/windows-offline branch from 46f67c5 to 5816b3a Compare June 6, 2025 03:02
@MaineK00n MaineK00n changed the title feat!(scanner/windows): allow only cab file scan for offline scan fix(scanner/windows): allow only cab file scan for offline scan Jun 6, 2025
@MaineK00n MaineK00n requested a review from shino June 9, 2025 03:23
@MaineK00n MaineK00n force-pushed the MaineK00n/windows-offline branch from 5816b3a to 99186b9 Compare June 9, 2025 03:23
@MaineK00n MaineK00n force-pushed the MaineK00n/windows-offline branch from 99186b9 to 775a043 Compare June 9, 2025 06:55
Copy link
Collaborator

@shino shino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥂

@MaineK00n MaineK00n merged commit 89ecfae into master Jun 9, 2025
7 checks passed
@MaineK00n MaineK00n deleted the MaineK00n/windows-offline branch June 9, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants