# Pointer Redirecting {{#include ../../banners/hacktricks-training.md}} ## String pointers Eğer bir fonksiyon çağrısı, yığında bulunan bir stringin adresini kullanacaksa, buffer overflow'u **bu adresi üzerine yazmak** ve **binaries içindeki farklı bir stringin adresini** koymak için kötüye kullanılabilir. Örneğin, bir **`system`** fonksiyon çağrısı **bir komutu çalıştırmak için bir stringin adresini kullanacaksa**, bir saldırgan **yığında farklı bir stringin adresini**, **`export PATH=.:$PATH`** yerleştirebilir ve mevcut dizinde **yeni stringin ilk harfi ile aynı isme sahip bir script oluşturabilir** çünkü bu binary tarafından çalıştırılacaktır. Bunun bir **örneğini** şurada bulabilirsiniz: - [https://github.com/florianhofhammer/stack-buffer-overflow-internship/blob/master/ASLR%20Smack%20and%20Laugh%20reference%20-%20Tilo%20Mueller/strptr.c](https://github.com/florianhofhammer/stack-buffer-overflow-internship/blob/master/ASLR%20Smack%20and%20Laugh%20reference%20-%20Tilo%20Mueller/strptr.c) - [https://guyinatuxedo.github.io/04-bof_variable/tw17_justdoit/index.html](https://guyinatuxedo.github.io/04-bof_variable/tw17_justdoit/index.html) - 32bit, yığında adresi değiştirerek flag stringini `puts` ile yazdırın ## Function pointers String pointer ile aynı ancak fonksiyonlara uygulanır, eğer **stack bir fonksiyonun adresini** içeriyorsa ve bu çağrılacaksa, **değiştirmek mümkündür** (örneğin **`system`** çağırmak için). Bir örneği şurada bulabilirsiniz: - [https://github.com/florianhofhammer/stack-buffer-overflow-internship/blob/master/ASLR%20Smack%20and%20Laugh%20reference%20-%20Tilo%20Mueller/funcptr.c](https://github.com/florianhofhammer/stack-buffer-overflow-internship/blob/master/ASLR%20Smack%20and%20Laugh%20reference%20-%20Tilo%20Mueller/funcptr.c) ## References - [https://github.com/florianhofhammer/stack-buffer-overflow-internship/blob/master/NOTES.md#pointer-redirecting](https://github.com/florianhofhammer/stack-buffer-overflow-internship/blob/master/NOTES.md#pointer-redirecting) {{#include ../../banners/hacktricks-training.md}}