Questions tagged [execve]

207 questions
0
votes
1 answer

CPU execution flow after execve buffer overflow completes successfully? ..after int 0x80 completes successfully?

I'm learning about buffer overflow shellcode methods under Linux. https://seedsecuritylabs.org/Labs_16.04/Software/Buffer_Overflow/ The shellcode I've used ends with movb $0x0b, %a1 and then int $0x80. The shellcode executes and I get my command…
0
votes
1 answer

What is the correct step to execute execve()?

It is required to use pipe(), fork(), execve() and dup() to implement a simple execution of terminal command with pipe for our homework. So I read about how dup and pipe manipulate the file descriptor, and I produced the code below. #include…
YiLuo
  • 107
  • 1
  • 9
0
votes
2 answers

Trouble with Forking Process and Calling bc using execve

my program is meant to fork a process, read from a file line by line within the parent and shove these lines down a pipe to be passed to bc which is called using execve. The file I am using is a text file that simply contains 5 + 10. Parent process…
0
votes
1 answer

execve does not inherit any filedescriptor

I'm writing a shell and try on implement process substitution. fork inherit of all filedescriptor, allocated memory etc. I understood that execve should keep also this kind of information, and so keep each opened filedescriptor, whenever O_CLOEXEC…
rSim
  • 344
  • 4
  • 17
0
votes
1 answer

sort called via execve from child does not terminate naturally

I'm trying to shove some text files through a pipe that has been dup'd over sort's stdin. It works, but it does not terminate naturally(Interestingly,pressing the "enter" button seems to do it). //child if(rc == 0) { alarm(60); …
0
votes
0 answers

How to return 0 after execve?

I need to return 0 after execve. Always, its not matter is there successfull or error. Just return 0. But after i use execve the program return nothing at all (execve return only errors and in my case there is no error, so nothing to return). Here…
Supply
  • 51
  • 2
  • 13
0
votes
1 answer

call ctypes.execve with dynamic list of argumenst

I want to use ctypes.execve within python to call an external script. I figured already out how to call the script and how to pass a list of arguments. But as you can see the list or arguments is quite static and I couldn't figure out how I can do…
Que
  • 1
  • 1
0
votes
1 answer

Distinguish interpreters for execve() in syscall sequence on Linux

How to know which interpreter it uses when execve() executes a file on Debian Linux, from its strace syscall logs? For example, how to know a file is executed as a bash script (#!/bin/bash), or a python script (#!/usr/bin/env python), or a pure ELF…
I Wonder
  • 168
  • 1
  • 2
  • 9
0
votes
1 answer

running multiple execve functions in one c++ file

I have to write a c++ program which "counts the number of lines, words and the number of bytes from a text file", all of which must be in a new line. I have to use the wc command in my c++ program. I have managed to get the number of lines: char…
Ofentse
  • 3
  • 2
0
votes
3 answers

Execve not working as expected

I am writing a basic shell in c that will allow me to execute simple commands(I am not asked to check for optional arguments) like "ls" in a server (localhost). The program must be able to handle multiple clients. I have done everything up to the…
Johnny Beltran
  • 701
  • 2
  • 8
  • 22
0
votes
2 answers

correct way to filter execve environment

I'm trying to write a LD_PRELOADable library that prevents processes from removing itself from this variable (to make sure children inherit it). So far I sucessfully wrapped putenv,setenv and clearenv, but execve gives me issues. My code so far: int…
nonchip
  • 1,084
  • 1
  • 18
  • 36
0
votes
1 answer

execve fails - ignores exit statement

I have a weird problem when mixing fgets and execve together. I have a function that reads lines from a file, and executes them, either by parsing them through it's own functions, or using execve. For the sake of simplicity, my test file only has…
ENBYSS
  • 819
  • 1
  • 10
  • 22
0
votes
0 answers

execve /bin/bash as child process. interacting with bash via parent process using pipes

I want to execve a bash as a child process in a c program. The bash should essentially be controlled by the parent process: the parent process reads from stdin, stores the read input into a buffer and writes the content of the buffer to the bash…
0
votes
1 answer

Assembly execve /bin/bash (x64)

I am new to asm and I am trying to execute a syscall to /bin/bash. However I am currently encountering the following problem: My code works for any execve call whose 1st argument length is less than 8 bytes, i.e "/bin/sh" or "/bin/ls" : .section…
Goujon
  • 37
  • 1
  • 7
0
votes
1 answer

What's wrong with this C code? The child is not returning?

Here's my attempt to try to understand how to do correct piping between two child processes. I'm simply trying to pass the output of one Linux command to another (ls to cat) and have the program return successfully. However, I'm guessing that the…
user3499524
  • 173
  • 9