Advertisement
--DSR--

F: buffer by LiTeRs50

May 16th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. Buffer overflow
  2.  
  3. what happens if a user sends 1040 bytes of data into a buffer zone that only can hold 1024 bytes of data?
  4. It would cause the buffer to be overflowed and it would overwrite parts of the memory.
  5. This way we can write a shell code with start at 1024 bytes and this will brake out of the buffer and be write to the memory if lucky.
  6.  
  7. But what is a buffer?
  8. Imagine that you're eating candy out of a bowl. You take one piece regularly.
  9. To prevent the bowl from running out, someone might refill the bowl before it gets empty,
  10. so that when you want to take another piece, there's candy in the bowl.
  11.  
  12. The bowl acts as a buffer between you and the candy bag.
  13.  
  14. Languages you could need to know if you want to do buffer overflow: C, C++, Fortran, Assembly
  15.  
  16. Example of vuln code:
  17. ...
  18. char buf[64], in[MAX_SIZE];
  19. printf("Enter buffer contents:\n");
  20. read(0, in, MAX_SIZE-1);
  21. printf("Bytes to copy:\n");
  22. scanf("%d", &bytes);
  23. memcpy(buf, in, bytes);
  24. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement