How to pass \x00 as argument to program?

前端 未结 6 1314
温柔的废话
温柔的废话 2021-01-05 19:51

I have a small program where I wish to pass shellcode as argument. In the shellcode, there is a necessity to pass \\x00. I tried the following command:

./pro         


        
6条回答
  •  鱼传尺愫
    2021-01-05 20:29

    Not at all. Unix uses C-style strings for the arguments a command is invoked with, and they are NUL-terminated character sequences.

    What you can do is to rewrite your program (or find an invocation variant) to accept the parameter in its standard input. NUL bytes work just fine there and are, in fact, widely used, typically as separators for file names, since they are pretty much the only thing a file name can never contain. See find's -print0 switch and xarg's switch -0 for the arguably most popular examples.

提交回复
热议问题