Index: src/wp-includes/canonical.php
===================================================================
--- src/wp-includes/canonical.php	(Revision 57099)
+++ src/wp-includes/canonical.php	(Arbeitskopie)
@@ -548,13 +548,18 @@
 	$is_attachment_redirect = false;
 
 	if ( is_attachment() && ! get_option( 'wp_attachment_pages_enabled' ) ) {
-		$attachment_id = get_query_var( 'attachment_id' );
+		$attachment_id        = get_query_var( 'attachment_id' );
+		$attachment_post      = get_post( $attachment_id );
+		$attachment_parent_id = $attachment_post ? $attachment_post->post_parent : 0;
 
-		if ( current_user_can( 'read_post', $attachment_id ) ) {
-			$redirect_url = wp_get_attachment_url( $attachment_id );
+		// If attachment is attached to a post, attachment page inherits parent post's private status,
+		// so fetch the post to have its private status checked later.
+		if ( $attachment_parent_id ) {
+			$redirect_obj = get_post ( $attachment_parent_id );
+		}
+		$redirect_url = wp_get_attachment_url( $attachment_id );
 
-			$is_attachment_redirect = true;
-		}
+		$is_attachment_redirect = true;
 	}
 
 	$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
