cmemory-leaksbuffer-overflowpayload

How to represent ASCII code 16 as a character?


[C language] [Linux]

"ASCII code 16 is represented by the control character ␐ also known as the data link escape"

I want to take this character from the keyboard as an input to a program that allows you to do a buffer overflow. It works only if i overwrite an INT variable with this value: 1161258512.

I don't know how to build this number because it s not possible to write the single character 16 as an input. I also tried with the escape sequence but it didn't work. Maybe i should use unicode to do that and write the first 2 characters (with the 16 included) of the 4 byte payload.

I'm new to this kind of things so please if you know more i would really appreciate it


Solution

  • it s not possible to write the single character 16 as an input

    This is a strange expression. DLE is 0x10, 16, as you know.

    How to get this from the keyboard depends much of many things you did not disclose: what OS?

    The control key on input

    The effect of pressing control as you type a key is to mask bits 5 and 6, those with values 32 and 64, so this is your answer:

    you can use Ctrl+P, Ctrl+p or Ctrl+0 since there 3 possible values:

    But to read this you need to prepare your keyboard driver. Under Linux and family pos-Unix use raw input and under Windows call ReadConsoleInput or similar.

    In short you save the input configuration, prepare it to some that suits your needs, such disabling echo and buffering, then read the key codes. And at the end you restore everything.

    Microsoft have a Console Reference. Under Linux man is your friend. Look for raw io and ioctl