A review of ITTC code.
This review was conducted before objectives crystallised. Activities: read key modules, ran test key creation, analysed one major bug in cert signing test (fix written but not compiled nor tested).
We can measure the code according to a few metrics:
Metric | Early verdict | Description | Recommendation |
---|---|---|---|
Secure against insider attack | ??? | No indication that packets are protected. | Rewrite the signing components? |
Secure against external attack | Probably, yes, but brittle. | If protected by machine, firewall, TLS. | ? |
Robust | No. | Mallocs, threads, gotos, big ifs => memory leaks and crashes. | Separate out cert signer into single, forking daemon, once per request ? |
Maintainable | No. | Too much emphasis on dangerous areas. | ? |
Instead of using ASN1 or some other volative system, the ITTC implements its own simple formats.
Things I don't like.
The protocol assumes that the other end is an exact copy; as the types and sizes are not defined (uses enums to allocate the numbers). This means that all share servers have to be upgraded together, in case there are changes.
The coding style is not defensive. In practice,
a function does all of what it intends,
so when it gets complex, the if
statements get messy.
Specifically,
apps_startup
)
Most of which could be eased by better layering within functions and use of more functions to firewall areas.
ittc_req main()
function does it all ... from arg parsing
to key creation.
UTL_Connection.UTL_SetupConnection()
The signature requestor application is one single file, with primarily one single function. It even creates the bignums within.
The API is effectively opening the key using ITTC_load_RSA_key(char *keyfilename) which returns a key that is pre-loaded with the context for the share servers.
It could be that this is clever because it then allows the OpenSSL key to be used as any other key?
Inconsistent styles. Very little commentary.
There appear to be these primary critical zones.
Each server will need to protected. The code for the protocol, incoming request handlers, outgoing request handlers, etc needs to be analysed to see how well it protects itself.
If protection is poor, the servers will have to do it (boring array of VPN, firewalls, etc).
Are the client requests authenticated? If not, the system is vulnerable to insider attack. (Probably CSRs are signed and ok. Checked?)
This is primarily about checking that it is robust, and can be firewalled off.
Client and server. Check the parsing of bad keys / requests. Fork protection in the server? Mallocs and structure are going to make this hard.
ITTC has these lines of code:
Module | Lines |
---|---|
ADM | 3071 |
COM | 4374 |
CTL | 1380 |
GEN | 4652 |
KEY | 2250 |
NTD | 388 |
REF | 352 |
TLB | 1898 |
UTL | 6322 |
apps | 14175 |
include | 3115 |
monitor | 202 |
tests | 2921 |
T O T A L | 45246 |