I am trying to retrieve a decrypting/deconing logic from a program. Unfortunately I have virtually no experiencing in reverse engineering.
I am building an alternative controller application for a multimedia device. The original controller is available for Windows (which I target) as well as for mac, ios and android. Most of the communication between the device and the controller application is similar to the UPnP protocol, therefor teransmitted in XML and readable in cleartext. There is one instance however where the device sends some sort of token to the controller (which the controller uses subsequently to authenticate against other services) and this transmission seems to be encoded/encrypted/obfuscated (referred as "encoded" in the text). This encoded form is transmitted in an XML field of a normal UPnP response.
I have made the following observations while monitoring several transmissions of the encoded form:
- It always starts with 2: and is followed by what seems to be a base64 encoded string
- When transmitted multiple times the sting changes even though the content supposedly did not change (this is under the assumption that no other variables like a timestamp are included before encoding). So some kind of salt could be present.
- The length of the string remains the same if the data is not changed
- If removing all tokens from the controller there is still some encoded data transmitted in this field. This leads me to thinking that either padding takes place, or (more likely) the encoded string decodes to some serialized from of data structure (maybe even XML).
- The token that is used for authentication (so the decoded form) does remain the same even though the encoded version differs.
The application itself is written in c# but all the security related stuff (including decoding/handling the token) seems to be called using pINVOKE from a DLL which was not written in .net.
I ran signsrch on the dll where I suspect the encoding to take place however a lot of possible hits are returned (30+). When taking a look at the dll it seems that the openssl library is compiled into it so there might be a lot of false positives. The DLL also handles HTTPS communication so openssl is not necessarily related to the encoding method I am looking for.
I've tried to look into ida pro and windbg however what I read from tutorials this mainly revolves around setting breakpoints before clicking on a button that activates e.g. a check routine. However in my case the controller application receives this data once on application start (with dozens of other UPnP packets) and my guess is that decoding takes place on receiving the packet so there is no possibility to set an breakpoint to e.g. a button. What I was able to figure out however is that the decoded tokens are present in memory (however offsets differ each time the application is started). The encoded version does not seem to be present in memory at runtime.
Some examples: Encoded String when no token is configured:
Three strings representing (supposedly) the same data:
I'd love to hear suggestions how to approach this problem to get more insight.