Shutdown of greater than 10% or equal to but less than 30% of network processing nodes without brute force actions, but does not shut down the network
Description
Brief/Intro
Note - This is an insight report, since there is no option to submit an insight, I am submitting it under low impact, kindly downgrade to insight from low.
Active.ts::ValidateRecordTypes miss out on checking some of the types
Vulnerability Details
In the function Active.ts::ValidateRecordTypes
exportfunctionvalidateRecordTypes(rec:P2P.ActiveTypes.Record):string {let err =validateTypes(rec, { active:'n', activated:'a', activatedPublicKeys:'a', })if (err) return errfor (constitemofrec.activated) {if (typeof item !=='string') return'items of activated array must be strings' }for (constitemofrec.activatedPublicKeys) {if (typeof item !=='string') return'items of activatedPublicKeys array must be strings' }return''}
The above function checks only for active, activated and activatedPublicKeys and their subelements (in case of arrays). The rec: P2P.ActiveTypes.Record type consists of 5 elements. These types are as follows
The issue is fairly simple and is insight, so I am providing only the necessary info for proof of concept.
exportfunctionvalidateRecordTypes(rec:P2P.ActiveTypes.Record):string {@>let err =validateTypes(rec, { // no checking for standby and maxSyncTime active:'n', activated:'a', activatedPublicKeys:'a', })if (err) return errfor (constitemofrec.activated) {if (typeof item !=='string') return'items of activated array must be strings' }for (constitemofrec.activatedPublicKeys) {if (typeof item !=='string') return'items of activatedPublicKeys array must be strings' }return''}
The above function is used by various other functions such as CycleCreator.ts::validateCertsRecordTypes, so it is fairly crucial
functionvalidateCertsRecordTypes(inp, caller) {let err =utils.validateTypes(inp, { certs:'a', record:'o' })if (err) {warn(caller +' bad input: '+ err +' '+Utils.safeStringify(inp))returnfalse }for (constcertofinp.certs) { err =utils.validateTypes(cert, { marker:'s', score:'n', sign:'o' })if (err) {warn(caller +' bad input.certs: '+ err)returnfalse } err =utils.validateTypes(cert.sign, { owner:'s', sig:'s' })if (err) {warn(caller +' bad input.sign: '+ err)returnfalse } } err =utils.validateTypes(inp.record, { activated:'a', activatedPublicKeys:'a', active:'n', apoptosized:'a', counter:'n', desired:'n', duration:'n', expired:'n', joined:'a', joinedArchivers:'a', joinedConsensors:'a', lost:'a', previous:'s', refreshedArchivers:'a', refreshedConsensors:'a', refuted:'a', removed:'a', start:'n', syncing:'n', })if (err) {warn(caller +' bad input.record: '+ err)returnfalse }// submodules need to validate their part of the recordfor (constsubmoduleof submodules) {@> err =submodule.validateRecordTypes(inp.record) // used hereif (err) {warn(caller +' bad input.record.* '+ err)returnfalse } }returntrue}