Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CVE-2018-6953] NDNTLV parser accepts Length field of the Name without any checks #195

Closed
blacksheeep opened this issue Feb 13, 2018 · 0 comments · Fixed by #197
Closed
Assignees

Comments

@blacksheeep
Copy link
Contributor

blacksheeep commented Feb 13, 2018

The Parser of NDNTLV accepts Length field of the Name without any checks.
Therefore, it is possible, that the value of the length flied of a component of a prefix and the actual size of the component differ.
in ccnl-pkt/ccnl-pkt-ndntlv.c:

161     while (len2 > 0) {
162           if (ccnl_ndntlv_dehead(&cp, &len2, (int*) &typ, &i)) {
...
172                   p->comp[p->compcnt] = cp;
173                   p->complen[p->compcnt] = i; 
...
175           }
176           cp += i;
177           len2 -= i;

This issue can lead to a out of bound memory access, when executing ccnl_ndntlv_dehead again.

Additionally, on many places CCN-lite assumes, that the length of the prefix is always correct.
By not having the length matching the actual component length, buffer overflows or out of bound memory accesses can occur on many places, e.g.:

  • ccnl_prefix_dup: buffer overflow, memcpy(p->bytes + len, prefix->comp[i], p->complen[i]); copies to many bytes if p->complen[i]) > len(prefix->comp[i]), which can lead to a buffer overflow of p->bytes.
  • ccnl_prefix_cmp: out of bound memory access, if (clen != nam->complen[i] || memcmp(comp, nam->comp[i], nam->complen[i])).
  • ccnl_prefix_debug_info: out of bound memory access, len += snprintf(buf + len, CCNL_MAX_PACKET_SIZE - len, "%.*s", p->complen[i], p->comp[i]);.
@blacksheeep blacksheeep changed the title NDNTLV parser accepts Length field of the Name without any checks [CVE-2018-6953] NDNTLV parser accepts Length field of the Name without any checks Feb 14, 2018
@mfrey mfrey closed this as completed in #197 Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants