Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CVE-2018-1160: libatalk/dsi: add correct bound checking to dsi_opense…
…ssion The memcpy memcpy(&dsi->attn_quantum, dsi->commands + i + 1, dsi->commands[i]); trusted dsi->commands[i] to specify a size that fits into dsi->attn_quantum. The sizeof attn_quantum is four bytes. A malicious client can send a dsi->command[i] larger than 4 bytes to begin overwriting variables in the DSI struct. dsi->command[i] is a single char in a char array which limits the amount of data the attacker can overwrite in the DSI struct to 0xff. So for this to be useful in an attack there needs to be something within the 0xff bytes that follow attn_quantum. From dsi.h: uint32_t attn_quantum, datasize, server_quantum; uint16_t serverID, clientID; uint8_t *commands; /* DSI recieve buffer */ uint8_t data[DSI_DATASIZ]; /* DSI reply buffer */ The commands pointer is a heap allocated pointer that is reused for every packet received and sent. Using the memcpy, an attacker can overwrite this to point to an address of their choice and then all subsequent AFP packets will be written to that location. If the attacker chose the preauth_switch buffer, overwriting the function pointer there with functions pointers of his choice, he can invoke this functions over the network, Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: HAT <hat@fa2.so-net.ne.jp> Reviewed-by: Andrew Stormont <andyjstormont@gmail.com> (cherry picked from commit b6895be)
- Loading branch information