LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 09-18-2006, 11:36 AM   #1
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 241

Rep: Reputation: 31
Soft Link on HTTP Server is lrwxrwxrwx


I made a soft link in a directory readable by any web browser. The link has the permissions lrwxrwxrwx. I'm not worried about the r's or the x's, but I'm concerned about that w. Does the w not mean that the link is world writable? Could it be rewritten by some one to point to something I don't want them to have access to?
 
Old 09-18-2006, 04:32 PM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
See this,

With root rights.. I do..
Code:
#ln -s /root/ /home/usera/stupidity

#ls -l /home/usera
lrwxrwxrwx  1 root  root   6 Sep 19 02:52 stupidity -> /root/
While i logon to usera & try to do
#ls -l /home/usera/
lrwxrwxrwx 1 root root 6 Sep 19 02:52 stupidity -> /root/

But when i try to
#ls -l /home/usera/stupidity
I get PERMISSION DENIED. Ma box says a

While as the symbolic link file still has rwx rights for others & hence i can do
#rm -f /home/usera/stupidity , though this doesnt means that the usera can delete my whole root directory subsystem as it will only delete the symobolic link & nothin else.

hOPE this would have clarified your queries.
 
Old 09-19-2006, 09:20 AM   #3
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 31
Let's say the userA issues the command

#ln -s /home/userA/lucky /home/userA/stupidity

Then userB logs in. Could userB then issue the command

#ln -s /home/userC/mail /home/userA/stupidity

???
 
Old 09-19-2006, 09:29 AM   #4
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by halfpower
Let's say the userA issues the command

#ln -s /home/userA/lucky /home/userA/stupidity

Then userB logs in. Could userB then issue the command

#ln -s /home/userC/mail /home/userA/stupidity

???
No, as userC would'nt have executable rights & hence can't go in /home/userC & hence cant run the command you have asked for.

ls -l /home will answer your query easily. No user can even browse others home directory & hence they can't do any linking further in other's home. (I assume that you are having default rights/permissions at user's HOME)
 
Old 09-19-2006, 11:19 AM   #5
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 241

Original Poster
Rep: Reputation: 31
There are some environments where everyone's user directory is readable to all other users by default. There are also other environments where a portion of a users home directory is readable to any person that can access http servers on the web. It was really the later environment that I had in mind.
 
Old 09-19-2006, 12:55 PM   #6
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by halfpower
There are some environments where everyone's user directory is readable to all other users by default. There are also other environments where a portion of a users home directory is readable to any person that can access http servers on the web. It was really the later environment that I had in mind.
I am sorry, i did'nt took that in consideration.

Quote:
Originally Posted by halfpower
Let's say the userA issues the command

#ln -s /home/userA/lucky /home/userA/stupidity

Then userB logs in. Could userB then issue the command

#ln -s /home/userC/mail /home/userA/stupidity
???
ln cant overwrite any link if you have'nt provided the "-f" handle with ln command. So if you run the above command with -f handle, i.e. #ln -s /home/userC/mail /home/userA/stupidity -f, yes it will override the existing symlink created by the other user. But be rest assured that we are not changing the contents of the file it is being pointed at. Its like updating the symbolic link with another destination now. And hence YES you can modify the symbolic link at any time because of the default permission of all 7 at it with any user(If you can read & cd into a directory containing the link).
 
Old 09-19-2006, 10:37 PM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
To set the record straight, the Linux kernel does not check permissions on symlinks, but rather the object to which they point. Otherwise, symlinks would pose a huge security hole (normal users could create a writable symlink pointing to a root-owned file like /etc/passwd and then edit it).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference Between Soft Link & Hard Link rajaniyer123 Solaris / OpenSolaris 16 09-30-2012 03:42 AM
Forbidden access to soft link on apache web server bnj Linux - Software 3 05-03-2005 08:14 AM
Soft Link and Hard Link Moataz Red Hat 1 04-25-2005 06:30 AM
Will soft link work? zulu1_hl Linux - Newbie 1 02-26-2003 02:39 PM
Soft link help Pyroknight Linux - Newbie 1 02-06-2003 06:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 11:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration