You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
currently we have a lint that rejects rules that contain negative numbers, specifically constants and offsets. i think this is primarily because its can be difficult to determine how immediate operands should be interpreted as signed or unsigned values. therefore, this restriction makes sense for constants/numbers; however, the way that we extract offsets (from memory reference operands) does support negative values. so, should we relax the lint and only enforce it on numbers/constants, but not offsets?
Short answer: no we do not officially support negative numbers
Because: By default both the viv and IDA APIs default to two's complement for representing numbers so capa can't match -1 because it only sees the two's complement form 0xFFFFFFFF.
However: It appears that the viv API does not default to two's complement for representing offsets which allows 0x-30 to match.
Unfortunately the IDA API does default to two's complement for representing offsets therefore, and I haven't tested this yet but I assume, this rule will match in viv but not in IDA.
I would probably consider this a bug as we need to establish a consistent representation of numbers, offsets, etc. across capa and the extractors.
looks like we can assume offsets are guaranteed to be signed, so we could enforce that feature extractors auto-convert twos complement to signed values
currently we have a lint that rejects rules that contain negative numbers, specifically constants and offsets. i think this is primarily because its can be difficult to determine how immediate operands should be interpreted as signed or unsigned values. therefore, this restriction makes sense for constants/numbers; however, the way that we extract offsets (from memory reference operands) does support negative values. so, should we relax the lint and only enforce it on numbers/constants, but not offsets?
related: mandiant/capa-rules#52
@mike-hunhoff @mr-tz
The text was updated successfully, but these errors were encountered: