Common stuff for all my devices' web server pages: css, login, log, ipv4, ipv6, firmware update, clock, reset info etc.

Dependents:   oldheating gps motorhome heating

Security

A password has to be set whenever there has been a software reset. Resets following faults or power on do not require a new password as the hash is restored from the RTC GPREG register.

The password is not saved on the device; instead a 32 bit hash of the password is saved. It would take 2^31 attempts to brute force the password: this could be done in under a month if an attempt were possible every millisecond. To prevent this a 200 ms delay is introduced in the reply to the login form, that gives a more reasonable 13 years to brute force the password.

Once the password is accepted a random session id is created. This is 36 bit to give six base 64 characters but without an extra delay. If an attempt could be made every ms then this would still take over a year to brute force.

The most likely attack would to use a dictionary with, say, 10 million entries against the password which would still take 20 days to do.

Committer:
andrewboyson
Date:
Tue Sep 24 18:16:47 2019 +0000
Revision:
130:9a5b8fe308f1
Parent:
119:794e5985d6c8
Child:
147:ea6f647725a1
Added http

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 109:3e82f62c7e1f 1 #include <stdint.h>
andrewboyson 109:3e82f62c7e1f 2 #include <stdbool.h>
andrewboyson 109:3e82f62c7e1f 3
andrewboyson 119:794e5985d6c8 4 extern void WebAddNavItem (int highlight, const char* href, const char* title);
andrewboyson 109:3e82f62c7e1f 5 extern void WebAddNav (int page);
andrewboyson 109:3e82f62c7e1f 6 extern void WebAddHeader (const char* title, const char* style, const char* script);
andrewboyson 109:3e82f62c7e1f 7 extern void WebAddH1 (const char* pageName);
andrewboyson 109:3e82f62c7e1f 8 extern void WebAddH2 (const char* text);
andrewboyson 109:3e82f62c7e1f 9 extern void WebAddEnd (void);
andrewboyson 109:3e82f62c7e1f 10
andrewboyson 119:794e5985d6c8 11 extern void WebAddLabelledText (const char* label, const char* text);
andrewboyson 119:794e5985d6c8 12 extern void WebAddLabelledPrefixSuffix(const char* label, const char* prefix, const char* text, const char* suffix);
andrewboyson 119:794e5985d6c8 13 extern void WebAddLabelledMac (const char* label, const char* mac);
andrewboyson 119:794e5985d6c8 14 extern void WebAddLabelledIp4 (const char* label, uint32_t ip);
andrewboyson 119:794e5985d6c8 15 extern void WebAddLabelledIp6 (const char* label, const char* ip);
andrewboyson 119:794e5985d6c8 16 extern void WebAddLabelledOnOff (const char* label, bool value);
andrewboyson 119:794e5985d6c8 17 extern void WebAddLabelledLed (const char* label, bool value);
andrewboyson 119:794e5985d6c8 18 extern void WebAddLabelledInt (const char* label, int value);
andrewboyson 109:3e82f62c7e1f 19
andrewboyson 119:794e5985d6c8 20 extern void WebAddInputText (const char* label, float inputwidth, const char* value, const char* action, const char* name);
andrewboyson 119:794e5985d6c8 21 extern void WebAddInputInt (const char* label, float inputwidth, int value, const char* action, const char* name);
andrewboyson 119:794e5985d6c8 22 extern void WebAddInputButton (const char* label, const char* value, const char* action, const char* name);
andrewboyson 109:3e82f62c7e1f 23
andrewboyson 119:794e5985d6c8 24 extern void WebAddAjaxLed (const char* label, const char* id);
andrewboyson 119:794e5985d6c8 25 extern void WebAddAjaxLabelled (const char* label, const char* id);
andrewboyson 119:794e5985d6c8 26 extern void WebAddAjaxLabelledSuffix (const char* label, const char* id, const char* suffix);
andrewboyson 119:794e5985d6c8 27 extern void WebAddAjaxInputToggle (const char* label, const char* id, const char* name);
andrewboyson 119:794e5985d6c8 28 extern void WebAddAjaxInput (const char* label, float inputwidth, const char* id, const char* name);
andrewboyson 119:794e5985d6c8 29 extern void WebAddAjaxInputSuffix (const char* label, float inputwidth, const char* id, const char* name, const char* suffix);
andrewboyson 119:794e5985d6c8 30 extern void WebAddAjaxInputLabelId (const char* labelId, float inputwidth, const char* id, const char* name);