Questions tagged [ld-preload]

LD_PRELOAD is a list of additional ELF shared objects that should be loaded first.

LD_PRELOAD is a list of additional ELF shared objects that should be loaded first.

For more information, visit this website

http://man7.org/linux/man-pages/man8/ld.so.8.html

265 questions
0
votes
1 answer

Intercepting Dynamic Memory Allocation Calls in Mozilla Firefox Web Browser

Is there a way to intercept "malloc, realloc, calloc and free" requested operations during Mozilla Firefox execution? I want to do something like using the LD_PRELOAD approach, where it is possible to intercept memory allocation operations in some…
Vinicius
  • 63
  • 1
  • 7
0
votes
2 answers

Why is the string specified in `LD_PRELOAD` loaded on the memory of setuid executables in RedHat 6.2?

First of all, let me tell you the context. I'm solving problems of the wargame called The lord of the BoF, which is based on RedHat Linux 6.2, which has no address space layout randomization(ASLR), NX bit, ASCII armor, etc.. And the gcc there does…
0
votes
1 answer

send a signal to lighttpd and the signal can be handled by the LD_PRELOADed library

Hi there:) I want to run lighttpd server with the LD_PRELOADed library, my LD_PRELOADed library called signal.so and it's code like this: #include struct sigaction sgSA; static void handler(int signo, siginfo_t *si, void *ptr) { …
0
votes
0 answers

Use LD_PRELOAD on ubuntu to intercept the network interaction of mysqld

I want to use LD_PRELOAD to intercept the network interaction(including listen, bind, send, recv,read,write, recvmsg, sendmsg of libc.so.6) of mysqld. I can intercept the network interaction of my own programs, but it didn't work on mysqld. Could…
Chalex
  • 321
  • 2
  • 9
0
votes
1 answer

LD_PRELOAD fails on specific folder

On Ubuntu 16.04 system, been trying to use ld_preload with custom compiled libpcap.so and run tcpdump. compiling libpcap (1.8.0) ./configure --prefix=`pwd`/inst make install then when using this command, tcpdump uses the custom…
Harse1946
  • 13
  • 2
0
votes
1 answer

Enable LD_PRELOAD just for BASh after system startup

Is there a way to inject/enable LD_PRELOAD just for new sessions (ie: BASh)? I have a syntax highlighting library that I want to have automatically enabled (ie: highlight warnings for certain users), and just need it loaded for BASh rather than all…
anon
0
votes
3 answers

Using LD_PRELOAD on kernel level functions

Is it possible to override one of the linux kernel functions using LD_PRELOAD? For instance, I want to change the cookie_hash function in Linux/net/ipv4/syncookie.c for the listening socket for my program fooserver. Can I do it using LD_PRELOAD, or…
Amir
  • 5,996
  • 13
  • 48
  • 61
0
votes
1 answer

Intercept open syscall for all binaries

I saw that intercepting fopen with LD_PRELOAD isn't 100% effective (demo below). Is there a catchall way to intercept the open syscall? My end goal is to present a different file than the one requested (e.g. when /etc/hosts is requested, return a…
Nitz
  • 320
  • 2
  • 9
0
votes
1 answer

How do I unload a library after it is LD_PRELOAD'ed?

We LD_PRELOAD a library for some feature, if I want to disable the feature and want to unload the library is there a way to do that ? I don't want to use RTLD, it has to be a LD_PRELOAD only so don't suggest dlsym. Also another use case is in case…
0
votes
0 answers

LD_PRELOAD on ls?

im using the below as a wrapper for the open() syscall on my system... i've compiled this into a .so file.... and put it in /etc/ld.so.preload. it appears to be working well... int open(__const char *pathname, int flags, mode_t mode) { …
Michael Xu
  • 557
  • 1
  • 5
  • 14
0
votes
0 answers

Berkeley DB works slowly after I hooked the recv function of mongoose

what I am doing is a little bit tricky. I tried to hook the recv function of mongoose using LD_PRELOAD. After mongoose receives a request, it will first of all store this request into Berkeley DB and then proceed. However, I found that the storing…
HuangJie
  • 1,488
  • 1
  • 16
  • 33
0
votes
1 answer

multiple LD_REPLOAD sharing variables

My purpose is quite simple: when I start the mongoose server, the server will initialize a variable which is defined by me. To do this, I hooked __libc_start_main. Then when the server receives a request, it will print out that initialized variable.…
HuangJie
  • 1,488
  • 1
  • 16
  • 33
0
votes
0 answers

file-scope mutable static HashSet/Vec/etc

I'd like to create C-linkage functions to intercept my program's calls via LD_PRELOAD but I'm implementing the interception functions in Rust. I have no problem creating the pub extern fn to intercept the calls but I'd like to read/write from the…
Brian Cain
  • 14,403
  • 3
  • 50
  • 88
0
votes
1 answer

RStudio - LD_PREOAD Issue

I get a RDOBC error in RStudio that does not occur when I use R on the server itself. R - R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" Copyright (C) 2014 The R Foundation for Statistical Computing Platform: x86_64-unknown-linux-gnu…
myloginid
  • 1,463
  • 2
  • 22
  • 37
0
votes
1 answer

Redirecting system() function call using LD_PRELOAD

I want to replace the calls to system() function made by my program using LD_PRELOAD. So I created the following wrapper functions in a shared library for testing. // syshook.c int system(const char * command) { printf("system() called for %s…
Sampath
  • 1
  • 4