我知道格式化字符串攻擊發生在格式化I/O函數需要比提供的更多參數時。爲什麼在C中發生格式串攻擊?
在C,
用於讀取存儲位置一個例子:
printf("%x"); // this prints a memory address location in the stack
用於重寫存儲器位置又如:
printf("Overwritten%n"); //this prints the number of chars in "Overwritten"
我的問題是:爲什麼會發生這種情況在兩種情況?爲什麼在沒有提供相應值的情況下只有格式化字符串中的%x會在內存中打印一個地址?那究竟是什麼地址?我知道發生了,但究竟發生了什麼?
與覆蓋相同。
我建議閱讀有關調用約定: http://en.wikipedia.org/wiki/Calling_convention –
按照從[Wikipedia文章]鏈接(http://en.wikipedia.org/wiki/Uncontrolled_format_string),搜索在那裏使用的術語。在YouTube上甚至還有關於此的視頻。 –