-
Notifications
You must be signed in to change notification settings - Fork 18
Description
When attempting to create a signature, it will sometimes fall into a limbo state where it doesn't appear in ThreatKB but can be seen in the DB (attempting to recreate the rule will result in a duplicate rule name error message). Using the id listed for the rule in the DB, the rule can be accessed via https://threatkb.inquest.net/#!/yara_rules/{id} but changes to the rule will not save and results in the following stacktrace message:
Traceback (most recent call last):
File "/opt/threatkb38/env/lib64/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/opt/threatkb38/env/lib64/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "/opt/threatkb38/env/lib64/python3.8/site-packages/flask_login/utils.py", line 272, in decorated_view
return func(*args, **kwargs)
File "/opt/threatkb38/app/routes/yara_rules.py", line 586, in update_yara_rule
db.session.commit()
File "", line 2, in commit
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/session.py", line 1435, in commit
self._transaction.commit(_to_root=self.future)
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/session.py", line 829, in commit
self._prepare_impl()
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/session.py", line 808, in _prepare_impl
self.session.flush()
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/session.py", line 3367, in flush
self._flush(objects)
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/session.py", line 3507, in flush
transaction.rollback(capture_exception=True)
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 70, in exit
compat.raise(
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/util/compat.py", line 207, in raise
raise exception
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/session.py", line 3467, in _flush
flush_context.execute()
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute
rec.execute(self)
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/unitofwork.py", line 630, in execute
util.preloaded.orm_persistence.save_obj(
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 253, in save_obj
_finalize_insert_update_commands(
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/persistence.py", line 1568, in _finalize_insert_update_commands
mapper.dispatch.after_update(mapper, connection, state)
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/event/attr.py", line 343, in call
fn(*args, **kw)
File "/opt/threatkb38/env/lib64/python3.8/site-packages/sqlalchemy/orm/events.py", line 743, in wrap
fn(*arg, **kw)
File "/opt/threatkb38/app/models/yara_rule.py", line 465, in yara_modified
state_activity_text = activity_log.get_state_change(target, target.name)
File "/opt/threatkb38/app/models/activity_log.py", line 86, in get_state_change
if o_state.is_release_state > 0 or o_state.is_retired_state > 0 or o_state.is_staging_state > 0
AttributeError: 'NoneType' object has no attribute 'is_release_state'
Example rule in limbo state:
SC_RDP_Properties_File_with_RemoteApp_Command_Line_Arguments
https://threatkb.inquest.net/#!/yara_rules/60769