Questions tagged [shellcode]

A shellcode is a small piece of code used as the payload in the exploitation of a software vulnerability.

Shellcodes get that name because they typically start a command shell from which the attacker can control the compromised machine. Shellcode is commonly written in machine code, but any piece of code that performs a similar task can be called shellcode. Because the function of a payload is not limited to merely spawning a shell, some have suggested that the name shellcode is insufficient.

Shellcode can either be local or remote, depending on whether it gives an attacker control over the machine it runs on (local) or over another machine through a network (remote).

681 questions
-2
votes
2 answers

Printing the complete size of char*

I'm working on a C project, the goal is to reach a web server, read the data inside a file (example.com/shellcode.bin for example) and store it inside an array. Currently, I managed to make the necessary GET requests, i can find my shellcode,…
-2
votes
1 answer

Why won't this shellcode execute?

I'm working through Hacking: The Art of Exploitation and am running into my first snag trying to get a known working exploit to run from the book via an environment variable. All programs were compiled with -fno-stack-protector -zexecstack -no-pie…
-2
votes
1 answer

Overwriting the stored return address on the stack doesn't work

I'm trying to take control of a C program's execution by overwriting the stored return address (saved eip) on the stack: (gdb) info frame Stack level 0, frame at 0xbffff550: eip = 0x8048831 in main (6.c:52); saved eip = 0xbffffdef source language…
Boris
  • 22,667
  • 16
  • 50
  • 71
-2
votes
1 answer

Shellcode works with Python but not with C

Practically I'm trying to execute a shellcode created from a small program in Asm x64, the problem is that it always gives me a segmentation fault error even if my shellcode is clean and I have compiled the program in C in the correct way. Assembly…
-2
votes
1 answer

Shellcode compiling errors

I wrote assembly code to test the shellcode example. However, I got the following errors when I compile assembly code. I've tried to compile assembly code as .S and .s too. also, I tried to compile as "gcc -nostdlib -static shellcode.s -o…
-2
votes
1 answer

Python string to shellcode byte

I am trying to make a program that generates shellcode, in Python3, I need to to convert a string to the "\x00\x00" format, for example: "Hello" -> "\x68\x65\x6c\x6c\x6f". I cannot figure this out, if I try to just add "\\x" to "68", it does not…
-2
votes
1 answer

What is the base address of a C program environment from the execle command?

I am reading the book "Hacking: The art of exploitation" and I have some problems with the code of exploit_notesearch_env.c It is attempting to do a buffer overflow exploit by calling the program to be exploited with the execle() function. That way…
ht332932
  • 85
  • 1
  • 5
-2
votes
1 answer

How to write shellcode in c?

i try to write shell code in file using c , but after execute the program i found the ASCII code not shell code in the file . this is the code : FILE *shell; shell = fopen("shell.txt", "w"); fprintf(shell,"shell = '\xbd\x7f\x94' \n"); …
-2
votes
1 answer

Prevent malicious code embedding

What a developer can do to prevent embedding of malicious code to their executable. Like how msfvenom, metasploit can embed payloads to any executable.
Mashhoor Gulati
  • 127
  • 3
  • 13
-2
votes
1 answer

How to open a file in assembly x86

I am trying to open a local file ('flag' in a target file) in assembly in order to write an exploit script output the flag. However, I am getting the error: "target: Too long input: Success" when trying to open the file. This is my code to load…
s.hu
  • 37
  • 1
  • 7
-2
votes
1 answer

What does [byte[]]$bytes = 0..65535|%{0} mean in powershell ?

I want add some powershell code in python,but meet '%{0}'in powershell when I use format function,then can't compile python.So I want to know the mean to change my code
-2
votes
2 answers

How to Remove NULL (00) from Machine Code?

I need to know how i remove the null (00) from machine code. i wrote the code in Assembly Language. It running Successfully. I need the output without NULL .data Bash: .asciz "/bin/hostname" Null1: .int 0 AddrToBash: .int 0 …
Neefra
  • 365
  • 1
  • 4
  • 5
-2
votes
1 answer

Why syscall instruction doesn't execute?

0x7fffffffeef8: xor %rsi,%rsi 0x7fffffffeefb: xor %rax,%rax <- now rax is 0 0x7fffffffeefe: movabs $0xff978cd091969dd1,%rbx <- rbx='/bin/dash' 0x7fffffffef08: neg %rbx 0x7fffffffef0b: push %rbx 0x7fffffffef0c: push …
Damotorie
  • 586
  • 7
  • 25
-2
votes
1 answer

Making my C program execute shellcode

I was trying to make my C program execute shellcode. Please look at the following. root@ninja:~/Desktop/Programs# gdb -q ./a.out Reading symbols from /root/Desktop/Programs/a.out...done. (gdb) list 1 1 void function(void) { 2 int *ret; 3 …
W. Zhu
  • 755
  • 6
  • 16
-2
votes
2 answers

Can you help me explaining the following C code?

int main(int argc, char **argv) { int (*func)(); func = (int (*)()) code; (int)(*func)(); } the variable code has some shellcode in it