diff --git src/wp-includes/formatting.php src/wp-includes/formatting.php
index e0b45fd..77cc68a 100644
--- src/wp-includes/formatting.php
+++ src/wp-includes/formatting.php
@@ -1379,10 +1379,12 @@ function sanitize_file_name( $filename ) {
 	 * @param string $filename_raw  Filename as it was passed into sanitize_file_name().
 	 */
 	$special_chars = apply_filters( 'sanitize_file_name_chars', $special_chars, $filename_raw );
+	$control_chars = array_map( 'chr', range( 1, 31 ) );
 	$filename = preg_replace( "#\x{00a0}#siu", ' ', $filename );
 	$filename = str_replace( $special_chars, '', $filename );
+	$filename = str_replace( $control_chars, '', $filename );
 	$filename = str_replace( array( '%20', '+' ), '-', $filename );
-	$filename = preg_replace( '/[\r\n\t -]+/', '-', $filename );
+	$filename = preg_replace( '/[\s-]+/', '-', $filename );
 	$filename = trim( $filename, '.-_' );
 
 	// Split the filename into a base and extension[s]
diff --git tests/phpunit/tests/formatting/SanitizeFileName.php tests/phpunit/tests/formatting/SanitizeFileName.php
index 8927fec..8572cf4 100644
--- tests/phpunit/tests/formatting/SanitizeFileName.php
+++ tests/phpunit/tests/formatting/SanitizeFileName.php
@@ -56,4 +56,17 @@ class Tests_Formatting_SanitizeFileName extends WP_UnitTestCase {
 	function test_replaces_percent_sign() {
 		$this->assertEquals( 'a22b.jpg', sanitize_file_name( 'a%22b.jpg' ) );
 	}
+
+	/**
+	 * @ticket 30495
+	 */
+	function test_replaces_control_chars() {
+		$control_chars = array_map( 'chr', range( 1, 31 ) );
+		$string = 'test';
+		foreach ( $control_chars as $char ) {
+			$string .= $char;
+		}
+		$string .= 'test';
+		$this->assertEquals( 'testtest', sanitize_file_name( $string ) );
+	}
 }
