Description Summary The software does not validate or incorrectly validates the
integrity check values or "checksums" of a message. This may prevent it from
detecting if the data has been modified or corrupted in transmission.
Extended Description : The failure to validate checksums before use results in an unnecessary risk that can easily be mitigated. The protocol specification describes the algorithm used for calculating the checksum. It is then a simple matter of implementing the calculation and verifying that the calculated checksum and the received checksum match. Failure to verify the calculated checksum and the received checksum can lead to far greater consequences.
Example 1 (Bad Code) C and C++ sd = socket(AF_INET, SOCK_DGRAM, 0); serv.sin_family =
AF_INET; serv.sin_addr.s_addr = htonl(INADDR_ANY); servr.sin_port = htons(1008); bind(sd, (struct sockaddr *) & serv, sizeof(serv)); while (1) { memset(msg, 0x0, MAX_MSG);
clilen = sizeof(cli);
if (inet_ntoa(cli.sin_addr)==...) n = recvfrom(sd, msg,
MAX_MSG, 0, (struct sockaddr *) & cli, &clilen);
} (Bad Code) Java while(true) { DatagramPacket packet = new
DatagramPacket(data,data.length,IPAddress, port);
socket.send(sendPacket);
}
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Page Last Updated:
October 29, 2009
|
|
CWE is a Software Assurance strategic initiative sponsored by the National Cyber Security Division of the U.S. Department of Homeland Security. This Web site is hosted by The MITRE Corporation. Contact cwe@mitre.org for more information. |
|||
