File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,9 +87,21 @@ Shellcode_Address = 0xc0000000 - 8 - strlen(vulnerable_program) - 1 - strlen(she
8787 Used to write char ` Y ` at ` [$esp+X] ` (treat ` $esp+X ` as a pointer)
8888
8989
90- Note: You could also use ` %Yu%X$n ` to write ` unsigned int ` . Change type to
91- meet your requirement.
92-
90+ Note:
91+ 1 . ` Y ` actually represents the fixed length in ` %Yc ` . In reality, you may need
92+ to calculate the exact data (address) you need to insert, especially there is
93+ additional chars at the beginning of the fmt. For example, for fmt ` "<pad> <address> %Yc%x$n" ` ,
94+ when you need to insert ` 0xbd ` , you have to calculate the value as follows:
95+ ```
96+ Y = 0xbd - len(address) - len(pad)
97+ ```
98+ 2 . ` X ` should be the offset of the address(es) to write data, not the start of the
99+ ` %Yc%X$n ` .
100+ 3 . You could also use ` %Yu%X$n ` to write ` unsigned int ` . Change type to
101+ meet your requirement.
102+ 4 . Using ` %u ` or ` %c ` is recommended as it is clearer to represent the endianness.
103+ Be aware of the value of ` Y ` if you use ` int ` or other types.
104+ 5 . Be aware of the endianness of the target computer.
93105
94106- Check Offset
95107 Since you could write data to where ` $esp+X ` is pointing to, you need
You can’t perform that action at this time.
0 commit comments