A few days ago a colleage and I were looking at a bug:
Issue: Connectors with a policy containing ja char’s in
etc do not start up. Loading the policy in a
browser, it is broken.
Okay, so let’s unpack that statement. Japanese characters in our
configuration is causing issues.
To understand how to correct this, we have to understand a few
When we generate an installer for any of the products we support
(windows, mac, android, linux etc). We inject a custom
configuration into the installer and sign the installer. The custom
configuration includes input from our end users. This can be as simple
as the name of a policy.
This specific defect was occurring with our windows agent.
To get to the bottom of this we will need to understand the
Below I’m using pedump on a .net binary that a candidate submitted as a
a sample solution to a programming problem.
The PE format instructs the windows OS on how to execute the program. The
interesting part of this format is the .rsrc section that describes
resources that are embedded in the binary. This is where we inject the
custom configuration. With the resource injection we also have to update
the size of the resource.
Let’s take a closer look. Below is a dump of the resources in the
binary. It shows a single resource with a size of 716, and name of #1.
This is where understanding encodings and the size becomes important.
Here’s an example in ruby:
So when calculating the size of the resource that is injected into the
executable we need to use the byte size, not just the number of