Skip to content

Exception in VirustTotal when uploading file #430

@kam193

Description

@kam193

Describe the bug
The VirusTotal service fails with an exception when it uploads a file. If the file already exists in VT, everything works.

To Reproduce
Steps to reproduce the behavior:

  1. Have a file that is not yet in the VT
  2. Have VT service configured to upload missing files
  3. Submit file with the VT enabled
  4. See error like:
  File "/var/lib/assemblyline/.local/lib/python3.11/site-packages/assemblyline_v4_service/common/base.py", line 177, in handle_task
    self.execute(request)
  File "/opt/al_service/virustotal/virustotal.py", line 220, in execute
    request.temp_submission_data["virus_total_vt3_files"] = package_scan_report(result_collection["file"])
                                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/al_service/virustotal/report.py", line 49, in package_scan_report
    json.dumps([
               ^
  File "/opt/al_service/virustotal/report.py", line 50, in <listcomp>
    _prune_vt3_summary(f)
  File "/opt/al_service/virustotal/report.py", line 37, in _prune_vt3_summary
    "md5": file["attributes"]["md5"],
           ~~~~~~~~~~~~~~~~~~^^^^^^^
KeyError: 'md5'

Expected behavior
File is uploaded, and the results are downloaded.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information if pertinent):

  • VT service: 4.7.0.4

Additional context
In the last 4.6.x version of VT service, I have also observed another problematic behavior: the service was not able to upload a new file at all, usually timeouting. I suspect it was waiting till VT finishes behavioral analysis, which could take a while.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions