News for hackers. Stuff that matters.
Re:Using SVN makes your site extremely vulnerable by hassy on Wednesday September 23, 2009 @08:21AM (#839105)
Summary:

A lot of people don't use "svn export" and leave .svn directories readable to everyone.

The authors of the article wrote a crawler that scanned 2.2 million domains, mostly in the .ru zone, for the vulnerability over the last couple of months.

They got access to (parts of) the source code of over 3 thousand sites, including some big ones like:

* yandex.ru and rambler.ru -- Russian search engines

* mail.ru -- Biggest Russian email host

* rbk.ru -- Large online publisher

* 003.ru, bolero.ru -- Online retailers

* habrahabr.ru -- Webdev/blogging/new media community site

* opera.com

Re:Using SVN makes your site extremely vulnerable by ionfish on Wednesday September 23, 2009 @06:54AM (#839017)
For your Apache config.

  # Disallow viewing of .svn and .git directory contents
  <DirectoryMatch \.(svn|git)>
    Order allow,deny
    Deny from all
  </DirectoryMatch>
Re:Using SVN makes your site extremely vulnerable by bcl on Wednesday September 23, 2009 @12:02PM (#839506)
May as well throw in .hg

Oh. Now we're blacklisting.

If you are going to use this solution, you are better off blacklisting all dotfiles except .htaccess, assuming you allow it.

Re:Using SVN makes your site extremely vulnerable by ionfish on Wednesday September 23, 2009 @12:13PM (#839528)
Even if you do use .htaccess files, you still shouldn't be showing them to anyone who requests them from your web server!
Re:Using SVN makes your site extremely vulnerable by bcl on Wednesday September 23, 2009 @04:42PM (#840080)
Ha! Correct!
Re:Using SVN makes your site extremely vulnerable by patio11 on Wednesday September 23, 2009 @10:34AM (#839301)
For Nginx:

location ~ /\.(svn|git) { deny all; }

Re:Using SVN makes your site extremely vulnerable by djdarkbeat on Wednesday October 28, 2009 @02:47PM (#908473)

  # Disallow viewing of .svn and .git and .hg directory contents
  <Directory ~ \.(svn|git|hg)>
    Order allow,deny
    Deny from all
  </Directory>
Re:Using SVN makes your site extremely vulnerable by djdarkbeat on Wednesday October 28, 2009 @01:47PM (#908338)
As well as leaving .gitignore exposed also.
Re:Using SVN makes your site extremely vulnerable by axod on Wednesday September 23, 2009 @09:49AM (#839224)
Title is misleading and plain wrong.

The issue is not in "using SVN". It's in using any revision control system that has .svn .git etc directories, and accidentally making those directories world readable from a webserver.

User error.

Re:Using SVN makes your site extremely vulnerable by cousin_it on Wednesday September 23, 2009 @09:37AM (#839207)
Russian speaker here, I'll translate some selected comments for your convenience.

harm: We need more people who, upon finding a hole, go on to scan the whole Runet, for no nefarious reasons but just to warn unwitting site owners.

SilenceAndy: In olden times such people were called hackers, until journalists perverted that word to mean cyber criminals.

grayhex: This comment is impervious to Google Translate.

cancel: Google inurl:.svn/entries, lots of interesting stuff.

Nirvanko: This ain't new, see http://www.adamgotterer.com/2009/01/26/hacking-the-svn-direc...

SynteZ: IIS doesn't have this vulnerability :-) By default it doesn't send files without extensions, because it doesn't know the mime type.

varyen: Funny, Wii disks from SEGA also have .svn folders, though they're empty.

crazywebdev: Now I know how http://vkontakte.ru came about.

Re:Using SVN makes your site extremely vulnerable by Sujan on Wednesday September 23, 2009 @06:36AM (#838998)
Using a working copy as your website is a pretty bad idea. That's what svn export is meant for.
Re:Using SVN makes your site extremely vulnerable by masklinn on Wednesday September 23, 2009 @06:40AM (#839003)
.

It's especially bad because svn puts a .svn in each directory. With e.g. mercurial or git, you can tuck the (visible) site in a subdirectory of the repo itself (project/pages), and the .hg/.git (project/.hg|project/.git) won't be accessible.

Of course the best option is still to use exports and symlinks.

Re:Using SVN makes your site extremely vulnerable by chrismear on Wednesday September 23, 2009 @06:54AM (#839016)
Of course, it's not too tricky to configure, say, Apache to block access to all the .svn directories:

http://www.subversionary.org/martintomes/preventing-access-t... http://blog.samdevore.com/archives/2006/05/01/hivelogic-prev...

Re:Using SVN makes your site extremely vulnerable by masklinn on Wednesday September 23, 2009 @09:23AM (#839180)
Case in point to complement my previous post:

http://fr.php.net/.svn/entries secure

http://fr2.php.net/.svn/entries open

Re:Using SVN makes your site extremely vulnerable by masklinn on Wednesday September 23, 2009 @08:01AM (#839080)
It's not, but if you ever forget to set this config anywhere, you're hosed.

The ideal way is to not take the risk in the first place. You can't forget something you don't have to do.

Re:Using SVN makes your site extremely vulnerable by thismat on Thursday September 24, 2009 @11:57AM (#841435)
Spot on. Even with proper auth rules it would still trouble me knowing I had my source exposed to the world. I'm a big fan of exports and now, thanks to you and masskin(sp?), really digging the symlinks idea.
Re:Using SVN makes your site extremely vulnerable by dolinsky on Wednesday September 23, 2009 @10:41AM (#839309)
I will echo the sentiments of Sujan and masklinn. A production machine should not have a checked out version of a repository on it ever. If you want the ability to rollback, you have the last N exports of your repo in their versioned folders with a symlink from a 'current' folder pointing to the revision you want on live.

Don't blame the tool, blame the individual for using it improperly.

Re:Using SVN makes your site extremely vulnerable by hlidotbe on Wednesday September 23, 2009 @06:44AM (#839008)
Using a working copy allows you to deploy your website faster and safer (only the changes gets transfered, you can have hooks to do some cleanup and rollbacks are almost free).

I use Mercurial on all my websites (disabling access to .*/.hg of course) and never use FTP for anything.

Re:Using SVN makes your site extremely vulnerable by masklinn on Wednesday September 23, 2009 @08:05AM (#839085)
> Using a working copy allows you to deploy your website faster and safer

It's clearly faster, it clearly is not safer, as the article demonstrate: if you forget to configure Apache to ignore the repo folders, your source code becomes available to the world.

> you can have hooks to do some cleanup and rollbacks are almost free

Export to versioned directories, then use symlinks to link your core to the right version of the site, and you get rollbacks for free as well. The only thing a WC gets you is deployment speed.

Re:Using SVN makes your site extremely vulnerable by ErrantX on Wednesday September 23, 2009 @06:54AM (#839018)
one good idea I had was using a patch queue to insert database and other "secret" settings into a Mercurial pull.

So when I deploy updates to sites we pull and update the changes then merge a locally stored patch queue to reconfigure the settings.

Because the settings are locally stored on the server (not in the site root) there is no way for people to steal the details from the public mercurial server :D

Re:Using SVN makes your site extremely vulnerable by walesmd on Wednesday September 23, 2009 @07:51AM (#839069)
This isn't really a vulnerability - just developers not doing their job. Anyone who uses SVN (or any other version management system, for that matter) should know how it works.

I know SVN creates these hidden directories (named .svn) within every directory of my project that contains the working copies of the files within that directory. Therefore I either use export (to not upload the hidden folders) or I make them not accessible to the public via .htaccess.

Saying this is a vulnerability is like telling someone copying/pasting their code into a Pastie is a vulnerability. Common sense.

Re:Using SVN makes your site extremely vulnerable by peterwwillis on Wednesday September 23, 2009 @10:45AM (#839320)
People mis-configure Apache all the time. They leave their site wide open for attack. They're vulnerable.

Saying it's not a vulnerability when 3,000 sites all have their source code visible to the world is like having your arm chopped off and saying "no it isn't, it's just a flesh wound."

I know it's not a cool remote root buffer overflow exploit hat trick 540 front side flip, but it's a security hole which people need to be educated about.

Re:Using SVN makes your site extremely vulnerable by walesmd on Wednesday September 23, 2009 @11:27AM (#839421)
But Apache isn't misconfigured in this instance - a file was uploaded and people are claiming that being able to view that file is a vulnerability.

I guess it is a vulnerability of the same standard as "My password is: password".

I just don't understand why everyone is up-in-arms and so surprised by this "vulnerability." It's common sense...

Re:Using SVN makes your site extremely vulnerable by InclinedPlane on Wednesday September 23, 2009 @06:24AM (#838988)
tl;dr Don't accidentally leave an svn working copy available to the internet, it could be a security vulnerability.
Re:Using SVN makes your site extremely vulnerable by masklinn on Wednesday September 23, 2009 @06:38AM (#839001)
Actually, TFA isn't about svn repositories but about using working copies for your production site, and leaving .svn world-readable. svn repositories tend to at least use some kind of HTTP auth (if not https or ssh), but a world-readable .svn means your whole project is available.
Re:Using SVN makes your site extremely vulnerable by InclinedPlane on Wednesday September 23, 2009 @06:50AM (#839012)
Yup, exactly. s/repositories/working copies/. I've been using git/hg too much lately.
Re:Using SVN makes your site extremely vulnerable by est on Wednesday September 23, 2009 @07:16AM (#839033)
Re:Using SVN makes your site extremely vulnerable by ErrantX on Wednesday September 23, 2009 @06:28AM (#838990)
Yes that was my thought too - at first I figured the translation was garbling what they were saying; I guess not.
Re:Using SVN makes your site extremely vulnerable by brown9-2 on Wednesday September 23, 2009 @08:55AM (#839138)
From the translation:

It would seem that in the XXI century is difficult to find such a vulnerability.

Do Russian speakers generally write the century in roman numerals like that? That's kind of neat..

Re:Using SVN makes your site extremely vulnerable by gcv on Wednesday September 23, 2009 @09:36AM (#839205)
Yes, it is customary in Russian writing to write century numbers in Roman numerals. The Russian language is going through a significant anglicization phase right now, though, so this will probably change.
Re:Using SVN makes your site extremely vulnerable by DrJokepu on Wednesday September 23, 2009 @07:31AM (#839051)
I'm no security expert but I'm not sure if I get it - assuming that your code is well written, how would exposing the source code and change history make it more vulnerable? By using this logic, every piece of open source software is "vulnerable". Security through obscurity is not really security.

I thought not checking in safety critical things such as passwords or keys into the repository tree is a standard practice. If it's not, it should be.

Re:Using SVN makes your site extremely vulnerable by maurycy on Wednesday September 23, 2009 @07:35AM (#839055)
It depends on what the threat is.

If the threat is finding vulnerability, then you are right. If the threat is leaking the source code to the competition, then it is a serious matter.

Also, keep in mind the deployed source code is different than just the source code; it usually contains things like the database credentials and such.

Re:Using SVN makes your site extremely vulnerable by DrJokepu on Wednesday September 23, 2009 @07:57AM (#839075)
Of course, but the "vulnerability" in this article was about the source code in the repository tree, not the deployed one. Also, I believe that database credentials should be stored in external configuration files (which, of course, shouldn't be browsable) so if they do an update, they don't have to add the credentials again.

About leaking the source: Yes, that could definitely be a problem, I agree, but I'm not sure if this can be considered as a vulnerability, more like carelessness on the part of the admin of the site.

Re:Using SVN makes your site extremely vulnerable by masklinn on Wednesday September 23, 2009 @09:22AM (#839179)
And as usual, PHP is at the top of the game: http://fr2.php.net/.svn/entries (note: interestingly, not all subdomains are open, the us* ones aren't, the uk* ones aren't either, and fr.php.net is also closed)
Re:Using SVN makes your site extremely vulnerable by fdeth on Wednesday September 23, 2009 @06:21AM (#838985)
Sorry for the machine translation but an English text is not up just yet.
Re:Using SVN makes your site extremely vulnerable by DannoHung on Wednesday September 23, 2009 @09:35AM (#839200)
It's actually surprisingly coherent. Is Russian easier to translate than other languages or has Google's automated translation just gotten that good?
Re:Using SVN makes your site extremely vulnerable by ilyak on Wednesday September 23, 2009 @09:48AM (#839223)
Russian language is indo-european, therefore the result is much better than if you're translating from chinese or turkish.

Google translate is good at lexical translation but still can't bind words together properly (and probably never will unless they'd change their paradigm).

I have to add that original text is surprisingly incoherent. They surely didn't re-read it after they wrote it.

Re:Using SVN makes your site extremely vulnerable by kennu on Wednesday September 23, 2009 @07:48AM (#839068)
Git is much nicer, because everything is in one .git directory and it can be kept outside the public webroot.
Re:Using SVN makes your site extremely vulnerable by seedy on Wednesday September 23, 2009 @10:01AM (#839247)
We deploy like this, and it looks like I cannot get to the source files in the way described.

It appears that IIS is naively not serving up these file types. If I drop a plain html file in the .svn folder I can get to it, but any .svn-base file or files lacking an extension are unreachable.

Re:Using SVN makes your site extremely vulnerable by AndrewDucker on Wednesday September 23, 2009 @06:43AM (#839006)
It's not actually clear to me what the problem is.

Are they saying that people can read your code (not actually a problem for open source projects) or that they can update it and thus alter your site?

The former doesn't seem so bad - the latter is obviously catastrophic.

I wish I spoke Russian...

Re:Using SVN makes your site extremely vulnerable by InclinedPlane on Wednesday September 23, 2009 @06:56AM (#839021)
Just reading. This is actually pretty bad. Consider all of the passwords embedded in connection strings and all the other various secrets contained in the source AND configuration files for a standard website. Even if your site uses all open source software, you still don't want J. Random Hacker to have write access to your database, for example.
Re:Using SVN makes your site extremely vulnerable by DrJokepu on Wednesday September 23, 2009 @07:42AM (#839059)
Maybe the real security problem is embedding passwords and other various secrets in the source code?
Re:Using SVN makes your site extremely vulnerable by AndrewDucker on Wednesday September 23, 2009 @07:56AM (#839074)
Of course, you database _really_ shouldn't be externally visible...
Re:Using SVN makes your site extremely vulnerable by jerf on Wednesday September 23, 2009 @10:49AM (#839337)
Well, don't forget about "security-in-depth". Combine "DB password on your website" with "remote unprivileged shell" on any server that can reach the DB, and now you've got a "shell into the DB".

Security exploits aren't just bad for what they directly allow, they are bad for how they often combine well.

(You, AndrewDucker, may already know this; I'm not trying to imply otherwise. I'm saying this because this is a point that needs to be made more often, too many people ignore it. Any unauthorized access into your system needs to be taken very seriously, because of this risk.)

Re:Using SVN makes your site extremely vulnerable by chrismear on Wednesday September 23, 2009 @06:51AM (#839014)
It's the former. Sure, it's not a problem if your code is already open-sourced, but plenty of people are working on things that aren't. And aside from code, you may have private data stored in your repository, such as API keys, or even just configuration information about your site setup that might help attackers.
Re:Using SVN makes your site extremely vulnerable by bcl on Wednesday September 23, 2009 @10:50AM (#839338)
Well duh. You shouldn't be publishing your repository. Use svn export instead.