named-data-iot / ndn-lite

A lightweight NDN protocol stack with high-level application support including security bootstrapping, access control, trust management, etc.
https://ndn-lite.named-data.net
GNU Lesser General Public License v3.0
44 stars 16 forks source link

ndn_interest_from_block buffer overflow #17

Closed yoursunny closed 5 years ago

yoursunny commented 5 years ago

As of 4fe193eddc7b5e2bf3ec62a790a1bd5247b6c7ff, ndn_interest_from_block function invokes:

else if (type == TLV_Parameters) {
  interest->enable_Parameters = 1;
  decoder_get_length(&decoder, &interest->parameters.size);
  decoder_get_raw_buffer_value(&decoder, interest->parameters.value,
                               interest->parameters.size);
}

interest->parameters.value is a fixed size buffer. interest->parameters.size comes from network and the function does not check whether it exceeds the buffer capacity. Therefore, an attacker can trigger a buffer overflow using this function.

Zhiyi-Zhang commented 5 years ago

Commit c03b56040b320de6c47ee32c5303d9b1bf8841a0 will address this issue. Thank you @yoursunny.