This is an old revision of the document!


Get a Life

1. SUID

  1. Cititi despre SUID aici
  2. Compilati programul de mai jos.
  3. Setati bitul de SUID pe binarul creat. (puteti folosi sudo)
  4. Este posibil sa fie nevoie sa setati utilizatorul root ca owner pe binar
  5. Afisati /etc/shadow folosind binarul creat fara a folosi sudo. (./binar)
#include <stdio.h> 
#include <stdlib.h> // For exit() 
 
int main() 
{ 
	FILE *fptr; 
 
	char filename[100], c; 
 
	printf("Enter the filename to open \n"); 
	scanf("%s", filename); 
 
	// Open file 
	fptr = fopen(filename, "r"); 
	if (fptr == NULL) 
	{ 
		printf("Cannot open file \n"); 
		exit(0); 
	} 
 
	// Read contents from file 
	c = fgetc(fptr); 
	while (c != EOF) 
	{ 
		printf ("%c", c); 
		c = fgetc(fptr); 
	} 
 
	fclose(fptr); 
	return 0; 
}
uso/laboratoare/new/10-sec/get-a-life.1544287306.txt.gz · Last modified: 2018/12/08 18:41 by octavian.guzu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0