Let's assume that you wrote a program to create a text file named file1.txt. In such programs, a malicious user or hacker might add some soft links to some important or sensitive file in the file that you want to create. As a result, it will lead to overwriting of the important file.
Understanding how vulnerabilities occur while accessing files in C
How to do it...
We will start by assuming that some important file by the name of file2.txt already exists on your computer and contains some sensitive information. Here are the steps that a malicious user or hacker can use in your program to create a file to overwrite file2.txt:
- A file pointer is defined.
- The hacker might create a soft link and attach a sensitive...