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

Dependents:   heating gps

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:
Wed May 01 10:40:51 2019 +0000
Revision:
113:23507d14f927
Parent:
core/web-add.h@110:8ab752842d25
Child:
118:53430a2a2595
Renamed 'core' to 'common'

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 109:3e82f62c7e1f 4 extern void WebAddNavItem (int highlight, char* href, 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 109:3e82f62c7e1f 11 extern void WebAddLabelledText (char* label, char* text);
andrewboyson 109:3e82f62c7e1f 12 extern void WebAddLabelledPrefixSuffix(char* label, char* prefix, char* text, char* suffix);
andrewboyson 109:3e82f62c7e1f 13 extern void WebAddLabelledMac (char* label, char* mac);
andrewboyson 109:3e82f62c7e1f 14 extern void WebAddLabelledIp4 (char* label, uint32_t ip);
andrewboyson 109:3e82f62c7e1f 15 extern void WebAddLabelledIp6 (char* label, char* ip);
andrewboyson 109:3e82f62c7e1f 16 extern void WebAddLabelledOnOff (char* label, bool value);
andrewboyson 109:3e82f62c7e1f 17 extern void WebAddLabelledInt (char* label, int value);
andrewboyson 109:3e82f62c7e1f 18
andrewboyson 109:3e82f62c7e1f 19 extern void WebAddInputText (char* label, float inputwidth, char* value, char* action, char* name);
andrewboyson 109:3e82f62c7e1f 20 extern void WebAddInputInt (char* label, float inputwidth, int value, char* action, char* name);
andrewboyson 109:3e82f62c7e1f 21 extern void WebAddInputButton (char* label, char* value, char* action, char* name);
andrewboyson 109:3e82f62c7e1f 22
andrewboyson 109:3e82f62c7e1f 23 extern void WebAddAjaxLed (char* label, char* id);
andrewboyson 109:3e82f62c7e1f 24 extern void WebAddAjaxLabelled (char* label, char* id);
andrewboyson 109:3e82f62c7e1f 25 extern void WebAddAjaxLabelledSuffix (char* label, char* id, char* suffix);
andrewboyson 109:3e82f62c7e1f 26 extern void WebAddAjaxInputToggle (char* label, char* id, char* name);
andrewboyson 109:3e82f62c7e1f 27 extern void WebAddAjaxInput (char* label, float inputwidth, char* id, char* name);
andrewboyson 109:3e82f62c7e1f 28 extern void WebAddAjaxInputSuffix (char* label, float inputwidth, char* id, char* name, char* suffix);
andrewboyson 109:3e82f62c7e1f 29 extern void WebAddAjaxInputLabelId (char* labelId, float inputwidth, char* id, char* name);