to: @chunyong-lin
cc: @ryandeivert @airbnb/binaryalert-maintainers
size: medium
Background
We've identified a number of relatively rare errors that can happen in the BinaryAlert analyzer. These errors are listed below, along with their fixes.
Changes
Problems and solutions:
Empty strings are allowed in S3 metadata, but they are not allowed in DynamoDB.
Fix: Replace empty strings before creating a Dynamo entry for a YARA match
In certain conditions, the analyzer can run out of /tmp disk space. We have been removing our own /tmp files, but it turns out yextend creates temporary files (likely due to pdftotext) which are not always removed correctly.
Fix: Instead of shredding just the downloaded binary, the analyzer now shreds the entire /tmp directory when it is done scanning a binary
There can be an IndexError when parsing yextend output, because detected offsets do not necessarily contain a colon. The code currently assumes all offsets are of the form 0x123:$var_name, but 0x123 can also be reported by YARA.
Fix: When reporting on matched strings, ignore offsets without a colon.
UPX output is cluttering the logs
Fix: All UPX output (stdout and stderr) is ignored
Yextend can sometimes report a single-line error message before its JSON output. This is likely due to pdftotext.
Fix: If JSON decoding of yextend output fails, we try again, skipping the first line.
Coverage decreased (-0.5%) to 92.519% when pulling ef253e5fc635aaed25764671857b8d05f68221a1 on austin-fix-errors into 20ee8528fdc6415a8653c971502de4da9b4be98f on master.
to: @chunyong-lin cc: @ryandeivert @airbnb/binaryalert-maintainers size: medium
Background
We've identified a number of relatively rare errors that can happen in the BinaryAlert analyzer. These errors are listed below, along with their fixes.
Changes
Problems and solutions:
/tmp
disk space. We have been removing our own/tmp
files, but it turns outyextend
creates temporary files (likely due topdftotext
) which are not always removed correctly./tmp
directory when it is done scanning a binaryIndexError
when parsingyextend
output, because detected offsets do not necessarily contain a colon. The code currently assumes all offsets are of the form0x123:$var_name
, but0x123
can also be reported by YARA.pdftotext
.yextend
output fails, we try again, skipping the first line.Other (non-analyzer):
CbEnterpriseResponseAPI
is deprecatedCbResponseAPI
pip3 install -r requirements.txt
throws a warning about moto being incompatible withpython-dateutils
.python-dateutils
to a version accepted bymoto
Testing
./manage.py live_test