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:
Wed Nov 14 15:27:22 2018 +0000
Revision:
7:fd8c2c5eeea7
Parent:
4:7737c5cfdf30
Child:
8:ccbb178e3629
Put trace info into settings

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 3:b58328ca6e70 1 #include <string.h>
andrewboyson 3:b58328ca6e70 2 #include "http.h"
andrewboyson 7:fd8c2c5eeea7 3 #include "settings.h"
andrewboyson 3:b58328ca6e70 4
andrewboyson 3:b58328ca6e70 5 void QueryAjaxTrace(char* pQuery)
andrewboyson 3:b58328ca6e70 6 {
andrewboyson 3:b58328ca6e70 7 while (pQuery)
andrewboyson 3:b58328ca6e70 8 {
andrewboyson 3:b58328ca6e70 9 char* pName;
andrewboyson 3:b58328ca6e70 10 char* pValue;
andrewboyson 3:b58328ca6e70 11 pQuery = HttpSplitQuery(pQuery, &pName, &pValue);
andrewboyson 3:b58328ca6e70 12
andrewboyson 3:b58328ca6e70 13 if (strcmp(pName, "trace-chg-log-uart" ) == 0) TraceChgLogUart();
andrewboyson 3:b58328ca6e70 14 if (strcmp(pName, "trace-hex-net-host" ) == 0) TraceParseNetHost(pValue);
andrewboyson 3:b58328ca6e70 15 if (strcmp(pName, "trace-chg-net-stack" ) == 0) TraceChgNetStack();
andrewboyson 3:b58328ca6e70 16 if (strcmp(pName, "trace-chg-net-newline" ) == 0) TraceChgNetNewLine();
andrewboyson 3:b58328ca6e70 17 if (strcmp(pName, "trace-chg-net-verbose" ) == 0) TraceChgNetVerbose();
andrewboyson 3:b58328ca6e70 18 if (strcmp(pName, "trace-chg-link" ) == 0) TraceChgLink();
andrewboyson 3:b58328ca6e70 19 if (strcmp(pName, "trace-chg-dns-name" ) == 0) TraceChgDnsName();
andrewboyson 3:b58328ca6e70 20 if (strcmp(pName, "trace-chg-dns-query" ) == 0) TraceChgDnsQuery();
andrewboyson 3:b58328ca6e70 21 if (strcmp(pName, "trace-chg-dns-reply" ) == 0) TraceChgDnsReply();
andrewboyson 3:b58328ca6e70 22 if (strcmp(pName, "trace-chg-dns-server" ) == 0) TraceChgDnsServer();
andrewboyson 3:b58328ca6e70 23 if (strcmp(pName, "trace-chg-ntp" ) == 0) TraceChgNtp();
andrewboyson 3:b58328ca6e70 24 if (strcmp(pName, "trace-chg-dhcp" ) == 0) TraceChgDhcp();
andrewboyson 3:b58328ca6e70 25 if (strcmp(pName, "trace-chg-ns-recv-sol" ) == 0) TraceChgNsRecvSol();
andrewboyson 3:b58328ca6e70 26 if (strcmp(pName, "trace-chg-ns-recv-adv" ) == 0) TraceChgNsRecvAdv();
andrewboyson 3:b58328ca6e70 27 if (strcmp(pName, "trace-chg-ns-send-sol" ) == 0) TraceChgNsSendSol();
andrewboyson 3:b58328ca6e70 28 if (strcmp(pName, "trace-chg-nr4" ) == 0) TraceChgNr4();
andrewboyson 3:b58328ca6e70 29 if (strcmp(pName, "trace-chg-nr6" ) == 0) TraceChgNr6();
andrewboyson 3:b58328ca6e70 30 if (strcmp(pName, "trace-chg-ntp-client" ) == 0) TraceChgNtpClient();
andrewboyson 3:b58328ca6e70 31 if (strcmp(pName, "trace-chg-sync" ) == 0) TraceChgSync();
andrewboyson 3:b58328ca6e70 32 if (strcmp(pName, "trace-chg-echo4" ) == 0) TraceChgEcho4();
andrewboyson 3:b58328ca6e70 33 if (strcmp(pName, "trace-chg-echo6" ) == 0) TraceChgEcho6();
andrewboyson 3:b58328ca6e70 34 if (strcmp(pName, "trace-chg-dest6" ) == 0) TraceChgDest6();
andrewboyson 3:b58328ca6e70 35 if (strcmp(pName, "trace-chg-ra" ) == 0) TraceChgRa();
andrewboyson 3:b58328ca6e70 36 if (strcmp(pName, "trace-chg-rs" ) == 0) TraceChgRs();
andrewboyson 3:b58328ca6e70 37 if (strcmp(pName, "trace-chg-ar4" ) == 0) TraceChgAr4();
andrewboyson 3:b58328ca6e70 38 if (strcmp(pName, "trace-chg-ar6" ) == 0) TraceChgAr6();
andrewboyson 3:b58328ca6e70 39 if (strcmp(pName, "trace-chg-arp" ) == 0) TraceChgArp();
andrewboyson 3:b58328ca6e70 40 if (strcmp(pName, "trace-chg-ip4" ) == 0) TraceChgIp4();
andrewboyson 3:b58328ca6e70 41 if (strcmp(pName, "trace-chg-ip6" ) == 0) TraceChgIp6();
andrewboyson 3:b58328ca6e70 42 if (strcmp(pName, "trace-chg-udp" ) == 0) TraceChgUdp();
andrewboyson 3:b58328ca6e70 43 if (strcmp(pName, "trace-chg-tcp" ) == 0) TraceChgTcp();
andrewboyson 3:b58328ca6e70 44 if (strcmp(pName, "trace-chg-http" ) == 0) TraceChgHttp();
andrewboyson 3:b58328ca6e70 45 if (strcmp(pName, "trace-chg-tftp" ) == 0) TraceChgTftp();
andrewboyson 3:b58328ca6e70 46 }
andrewboyson 3:b58328ca6e70 47 }
andrewboyson 3:b58328ca6e70 48