I recently updated my WordPress version to 3.5.1 and noticed an issue with all images linking to an attachment page by default instead of the image file. This is a known bug with WordPress where the link=”file” is not being added in the gallery shortcode, despite the Link To being set to Media. (see http://core.trac.wordpress.org/ticket/23298#no1)
There is however a work around, you can edit the media.php file to permanently link images to their original file and never use an attachment page although when you next update WordPress, the changes will be lost so make a note just incase (hopefully they would have fixed this issue by then anyway!).
Details
WP Version: 3.5.1
File: wp-includes/media.php
Line: 780
Code: $link = isset($attr[‘link’]) && ‘file’ == $attr[‘link’] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, false, false);