-
Notifications
You must be signed in to change notification settings - Fork 85
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
Wrong object names #12
Comments
Normally that doesn't happen. Can I get a copy of the actual document with macros? Maybe there's something weird in it. |
Sure, sample sended. |
Thanks. OK, I can see why this is happening. Problem is, I don't see how to fix it... The code that is causing the problem is this:
If I don't subtract 1, this sample will be disassembled correctly. But then others (that are now disassembled correctly) won't be. I'll have to see if I can find a way to fix it properly, but for now I have no idea how. |
I would be happy to help you. |
The purpose of the function this code resides in is to take the operand of an opcode instruction that refers to a symbolic argument (like a variable or function name) and locate the corresponding symbol in the symbol table. Problem is, the algorithms have changed with the VBA and Office versions and it's a bit of a hit-and-miss to figure out the correct one. I'll keep digging. The problem is further exacerbated by the fact that I don't have all the Office versions. The last one that I have is 2002. I have some documents created by later versions (like 2010 and 2013) but I don't have these versions of Office, so I can't freely experiment with them. And I don't think I have anything created with Office 2016 or Office 365... |
I really don't know how to solve this... If I don't subtract 1 there, the macro in the document in this repository won't be disassembled correctly. If I do, your Emotet sample won't be disassembled correctly.... On the top of everything, both problematic documents are made with an Office version that I don't have and can't experiment freely with... I'll keep digging but for now I'm out of ideas. |
If you need sample files created with different versions of Office, maybe we can help. What would you need exactly? |
I'm not really sure; I would have preferred to experiment with different things myself... For starters, the problem seems to occur when the VBA project uses lots of different symbols - like 200 or more. |
I met this problem too, any more progress? |
No, I couldn't figure out how to solve it, sorry. |
Share with me a sample where this occurs and a normal one; I will dig it and see whether I can figure it out |
I've noticed that the Pafish.docm document has an empty identifier. Empty identifiers are not appended to the identifier list, and I guess that is the reason why the index does not match? I'd suggest: if idLength:
ident = decode(vbaProjectData[offset:offset + idLength])
identifiers.append(ident)
offset += idLength
else:
identifiers.append("<unknown>") |
What is an empty identifier? Anyway, your proposed change does not solve the problem - it just makes the output wrong in a different way. I'm not accepting it. |
I mean an identifier without a name (where idLength is 0)
I forgot to mention that this part:
has to be removed as well, because the index adjustment is not needed anymore. I've tested it and it seems it work:
|
OK, this seems to work. I'm a bit busy right now but when I can find the time (and remember how to release a new version on PyPi), I'll merge your change. |
The code is using the wrong object names. And more specifically, it's choosing the name of the previous object as the current one, so all the names of the objects / functions in the macro are wrong.
Maybe the (empty macro) is making the algorithm confused.
The text was updated successfully, but these errors were encountered: