-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPATCH.patch
executable file
·2481 lines (2208 loc) · 101 KB
/
PATCH.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -Naur drupal-7.42/CHANGELOG.txt drupal-7.43/CHANGELOG.txt
--- drupal-7.42/CHANGELOG.txt 2016-02-03 17:26:13.000000000 +0100
+++ drupal-7.43/CHANGELOG.txt 2016-02-24 20:26:52.000000000 +0100
@@ -1,4 +1,8 @@
+Drupal 7.43, 2016-02-24
+-----------------------
+- Fixed security issues (multiple vulnerabilities). See SA-CORE-2016-001.
+
Drupal 7.42, 2016-02-03
-----------------------
- Stopped invoking hook_flush_caches() on every cron run, since some modules
diff -Naur drupal-7.42/includes/bootstrap.inc drupal-7.43/includes/bootstrap.inc
--- drupal-7.42/includes/bootstrap.inc 2016-02-03 17:26:13.000000000 +0100
+++ drupal-7.43/includes/bootstrap.inc 2016-02-24 20:26:52.000000000 +0100
@@ -8,7 +8,7 @@
/**
* The current system version.
*/
-define('VERSION', '7.42');
+define('VERSION', '7.43');
/**
* Core API compatibility.
diff -Naur drupal-7.42/includes/common.inc drupal-7.43/includes/common.inc
--- drupal-7.42/includes/common.inc 2016-02-03 17:26:13.000000000 +0100
+++ drupal-7.43/includes/common.inc 2016-02-24 20:26:52.000000000 +0100
@@ -688,6 +688,13 @@
$options['fragment'] = $destination['fragment'];
}
+ // In some cases modules call drupal_goto(current_path()). We need to ensure
+ // that such a redirect is not to an external URL.
+ if ($path === current_path() && empty($options['external']) && url_is_external($path)) {
+ // Force url() to generate a non-external URL.
+ $options['external'] = FALSE;
+ }
+
drupal_alter('drupal_goto', $path, $options, $http_response_code);
// The 'Location' HTTP header must be absolute.
@@ -2220,20 +2227,8 @@
'prefix' => ''
);
- // A duplicate of the code from url_is_external() to avoid needing another
- // function call, since performance inside url() is critical.
if (!isset($options['external'])) {
- // Return an external link if $path contains an allowed absolute URL. Avoid
- // calling drupal_strip_dangerous_protocols() if there is any slash (/),
- // hash (#) or question_mark (?) before the colon (:) occurrence - if any -
- // as this would clearly mean it is not a URL. If the path starts with 2
- // slashes then it is always considered an external URL without an explicit
- // protocol part.
- $colonpos = strpos($path, ':');
- $options['external'] = (strpos($path, '//') === 0)
- || ($colonpos !== FALSE
- && !preg_match('![/?#]!', substr($path, 0, $colonpos))
- && drupal_strip_dangerous_protocols($path) == $path);
+ $options['external'] = url_is_external($path);
}
// Preserve the original path before altering or aliasing.
@@ -2353,12 +2348,18 @@
*/
function url_is_external($path) {
$colonpos = strpos($path, ':');
- // Avoid calling drupal_strip_dangerous_protocols() if there is any slash (/),
- // hash (#) or question_mark (?) before the colon (:) occurrence - if any - as
- // this would clearly mean it is not a URL. If the path starts with 2 slashes
- // then it is always considered an external URL without an explicit protocol
- // part.
+ // Some browsers treat \ as / so normalize to forward slashes.
+ $path = str_replace('\\', '/', $path);
+ // If the path starts with 2 slashes then it is always considered an external
+ // URL without an explicit protocol part.
return (strpos($path, '//') === 0)
+ // Leading control characters may be ignored or mishandled by browsers, so
+ // assume such a path may lead to an external location. The \p{C} character
+ // class matches all UTF-8 control, unassigned, and private characters.
+ || (preg_match('/^\p{C}/u', $path) !== 0)
+ // Avoid calling drupal_strip_dangerous_protocols() if there is any slash
+ // (/), hash (#) or question_mark (?) before the colon (:) occurrence - if
+ // any - as this would clearly mean it is not a URL.
|| ($colonpos !== FALSE
&& !preg_match('![/?#]!', substr($path, 0, $colonpos))
&& drupal_strip_dangerous_protocols($path) == $path);
diff -Naur drupal-7.42/includes/path.inc drupal-7.43/includes/path.inc
--- drupal-7.42/includes/path.inc 2016-02-03 17:26:13.000000000 +0100
+++ drupal-7.43/includes/path.inc 2016-02-24 20:26:52.000000000 +0100
@@ -347,7 +347,8 @@
* drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL) makes this function available.
*
* @return
- * The current Drupal URL path.
+ * The current Drupal URL path. The path is untrusted user input and must be
+ * treated as such.
*
* @see request_path()
*/
diff -Naur drupal-7.42/includes/xmlrpcs.inc drupal-7.43/includes/xmlrpcs.inc
--- drupal-7.42/includes/xmlrpcs.inc 2016-02-03 17:26:13.000000000 +0100
+++ drupal-7.43/includes/xmlrpcs.inc 2016-02-24 20:26:52.000000000 +0100
@@ -264,6 +264,10 @@
*/
function xmlrpc_server_multicall($methodcalls) {
// See http://www.xmlrpc.com/discuss/msgReader$1208
+ // To avoid multicall expansion attacks, limit the number of duplicate method
+ // calls allowed with a default of 1. Set to -1 for unlimited.
+ $duplicate_method_limit = variable_get('xmlrpc_multicall_duplicate_method_limit', 1);
+ $method_count = array();
$return = array();
$xmlrpc_server = xmlrpc_server_get();
foreach ($methodcalls as $call) {
@@ -273,10 +277,14 @@
$ok = FALSE;
}
$method = $call['methodName'];
+ $method_count[$method] = isset($method_count[$method]) ? $method_count[$method] + 1 : 1;
$params = $call['params'];
if ($method == 'system.multicall') {
$result = xmlrpc_error(-32600, t('Recursive calls to system.multicall are forbidden.'));
}
+ elseif ($duplicate_method_limit > 0 && $method_count[$method] > $duplicate_method_limit) {
+ $result = xmlrpc_error(-156579, t('Too many duplicate method calls in system.multicall.'));
+ }
elseif ($ok) {
$result = xmlrpc_server_call($xmlrpc_server, $method, $params);
}
diff -Naur drupal-7.42/modules/aggregator/aggregator.info drupal-7.43/modules/aggregator/aggregator.info
--- drupal-7.42/modules/aggregator/aggregator.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/aggregator/aggregator.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
configure = admin/config/services/aggregator/settings
stylesheets[all][] = aggregator.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/aggregator/tests/aggregator_test.info drupal-7.43/modules/aggregator/tests/aggregator_test.info
--- drupal-7.42/modules/aggregator/tests/aggregator_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/aggregator/tests/aggregator_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/block/block.info drupal-7.43/modules/block/block.info
--- drupal-7.42/modules/block/block.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/block/block.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
files[] = block.test
configure = admin/structure/block
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/block/tests/block_test.info drupal-7.43/modules/block/tests/block_test.info
--- drupal-7.42/modules/block/tests/block_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/block/tests/block_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/block/tests/themes/block_test_theme/block_test_theme.info drupal-7.43/modules/block/tests/themes/block_test_theme/block_test_theme.info
--- drupal-7.42/modules/block/tests/themes/block_test_theme/block_test_theme.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/block/tests/themes/block_test_theme/block_test_theme.info 2016-02-24 20:51:46.000000000 +0100
@@ -13,8 +13,8 @@
regions[highlighted] = Highlighted
regions[help] = Help
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/blog/blog.info drupal-7.43/modules/blog/blog.info
--- drupal-7.42/modules/blog/blog.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/blog/blog.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = blog.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/book/book.info drupal-7.43/modules/book/book.info
--- drupal-7.42/modules/book/book.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/book/book.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
configure = admin/content/book/settings
stylesheets[all][] = book.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/color/color.info drupal-7.43/modules/color/color.info
--- drupal-7.42/modules/color/color.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/color/color.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = color.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/comment/comment.info drupal-7.43/modules/comment/comment.info
--- drupal-7.42/modules/comment/comment.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/comment/comment.info 2016-02-24 20:51:46.000000000 +0100
@@ -9,8 +9,8 @@
configure = admin/content/comment
stylesheets[all][] = comment.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/contact/contact.info drupal-7.43/modules/contact/contact.info
--- drupal-7.42/modules/contact/contact.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/contact/contact.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
files[] = contact.test
configure = admin/structure/contact
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/contextual/contextual.info drupal-7.43/modules/contextual/contextual.info
--- drupal-7.42/modules/contextual/contextual.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/contextual/contextual.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = contextual.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/dashboard/dashboard.info drupal-7.43/modules/dashboard/dashboard.info
--- drupal-7.42/modules/dashboard/dashboard.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/dashboard/dashboard.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
dependencies[] = block
configure = admin/dashboard/customize
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/dblog/dblog.info drupal-7.43/modules/dblog/dblog.info
--- drupal-7.42/modules/dblog/dblog.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/dblog/dblog.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = dblog.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/field.info drupal-7.43/modules/field/field.info
--- drupal-7.42/modules/field/field.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/field.info 2016-02-24 20:51:46.000000000 +0100
@@ -11,8 +11,8 @@
required = TRUE
stylesheets[all][] = theme/field.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/modules/field_sql_storage/field_sql_storage.info drupal-7.43/modules/field/modules/field_sql_storage/field_sql_storage.info
--- drupal-7.42/modules/field/modules/field_sql_storage/field_sql_storage.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/modules/field_sql_storage/field_sql_storage.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
files[] = field_sql_storage.test
required = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/modules/list/list.info drupal-7.43/modules/field/modules/list/list.info
--- drupal-7.42/modules/field/modules/list/list.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/modules/list/list.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
dependencies[] = options
files[] = tests/list.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/modules/list/tests/list_test.info drupal-7.43/modules/field/modules/list/tests/list_test.info
--- drupal-7.42/modules/field/modules/list/tests/list_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/modules/list/tests/list_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
version = VERSION
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/modules/number/number.info drupal-7.43/modules/field/modules/number/number.info
--- drupal-7.42/modules/field/modules/number/number.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/modules/number/number.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
dependencies[] = field
files[] = number.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/modules/options/options.info drupal-7.43/modules/field/modules/options/options.info
--- drupal-7.42/modules/field/modules/options/options.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/modules/options/options.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
dependencies[] = field
files[] = options.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/modules/text/text.info drupal-7.43/modules/field/modules/text/text.info
--- drupal-7.42/modules/field/modules/text/text.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/modules/text/text.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
files[] = text.test
required = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field/tests/field_test.info drupal-7.43/modules/field/tests/field_test.info
--- drupal-7.42/modules/field/tests/field_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field/tests/field_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
version = VERSION
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/field_ui/field_ui.info drupal-7.43/modules/field_ui/field_ui.info
--- drupal-7.42/modules/field_ui/field_ui.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/field_ui/field_ui.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
dependencies[] = field
files[] = field_ui.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/file/file.info drupal-7.43/modules/file/file.info
--- drupal-7.42/modules/file/file.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/file/file.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
dependencies[] = field
files[] = tests/file.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/file/file.module drupal-7.43/modules/file/file.module
--- drupal-7.42/modules/file/file.module 2016-02-03 17:26:13.000000000 +0100
+++ drupal-7.43/modules/file/file.module 2016-02-24 20:26:52.000000000 +0100
@@ -529,14 +529,19 @@
// publicly accessible, with no download restrictions; for security
// reasons all other schemes must go through the file_download_access()
// check.
- if (in_array(file_uri_scheme($file->uri), variable_get('file_public_schema', array('public'))) || file_download_access($file->uri)) {
- $fid = $file->fid;
+ if (!in_array(file_uri_scheme($file->uri), variable_get('file_public_schema', array('public'))) && !file_download_access($file->uri)) {
+ $force_default = TRUE;
}
- // If the current user doesn't have access, don't let the file be
- // changed.
- else {
+ // Temporary files that belong to other users should never be allowed.
+ // Since file ownership can't be determined for anonymous users, they
+ // are not allowed to reuse temporary files at all.
+ elseif ($file->status != FILE_STATUS_PERMANENT && (!$GLOBALS['user']->uid || $file->uid != $GLOBALS['user']->uid)) {
$force_default = TRUE;
}
+ // If all checks pass, allow the file to be changed.
+ else {
+ $fid = $file->fid;
+ }
}
}
}
diff -Naur drupal-7.42/modules/file/tests/file.test drupal-7.43/modules/file/tests/file.test
--- drupal-7.42/modules/file/tests/file.test 2016-02-03 17:26:13.000000000 +0100
+++ drupal-7.43/modules/file/tests/file.test 2016-02-24 20:26:52.000000000 +0100
@@ -218,6 +218,30 @@
$message = isset($message) ? $message : format_string('File %file is permanent.', array('%file' => $file->uri));
$this->assertTrue($file->status == FILE_STATUS_PERMANENT, $message);
}
+
+ /**
+ * Creates a temporary file, for a specific user.
+ *
+ * @param string $data
+ * A string containing the contents of the file.
+ * @param int $uid
+ * The user ID of the file owner.
+ *
+ * @return object
+ * A file object, or FALSE on error.
+ */
+ function createTemporaryFile($data, $uid = NULL) {
+ $file = file_save_data($data, NULL, NULL);
+
+ if ($file) {
+ $file->uid = isset($uid) ? $uid : $this->admin_user->uid;
+ // Change the file status to be temporary.
+ $file->status = NULL;
+ return file_save($file);
+ }
+
+ return $file;
+ }
}
/**
@@ -527,6 +551,120 @@
}
/**
+ * Tests exploiting the temporary file removal of another user using fid.
+ */
+ function testTemporaryFileRemovalExploit() {
+ // Create a victim user.
+ $victim_user = $this->drupalCreateUser();
+
+ // Create an attacker user.
+ $attacker_user = $this->drupalCreateUser(array(
+ 'access content',
+ 'create page content',
+ 'edit any page content',
+ ));
+
+ // Log in as the attacker user.
+ $this->drupalLogin($attacker_user);
+
+ // Perform tests using the newly created users.
+ $this->doTestTemporaryFileRemovalExploit($victim_user->uid, $attacker_user->uid);
+ }
+
+ /**
+ * Tests exploiting the temporary file removal for anonymous users using fid.
+ */
+ public function testTemporaryFileRemovalExploitAnonymous() {
+ // Set up an anonymous victim user.
+ $victim_uid = 0;
+
+ // Set up an anonymous attacker user.
+ $attacker_uid = 0;
+
+ // Set up permissions for anonymous attacker user.
+ user_role_change_permissions(DRUPAL_ANONYMOUS_RID, array(
+ 'access content' => TRUE,
+ 'create page content' => TRUE,
+ 'edit any page content' => TRUE,
+ ));
+
+ // In order to simulate being the anonymous attacker user, we need to log
+ // out here since setUp() has logged in the admin.
+ $this->drupalLogout();
+
+ // Perform tests using the newly set up users.
+ $this->doTestTemporaryFileRemovalExploit($victim_uid, $attacker_uid);
+ }
+
+ /**
+ * Helper for testing exploiting the temporary file removal using fid.
+ *
+ * @param int $victim_uid
+ * The victim user ID.
+ * @param int $attacker_uid
+ * The attacker user ID.
+ */
+ protected function doTestTemporaryFileRemovalExploit($victim_uid, $attacker_uid) {
+ // Use 'page' instead of 'article', so that the 'article' image field does
+ // not conflict with this test. If in the future the 'page' type gets its
+ // own default file or image field, this test can be made more robust by
+ // using a custom node type.
+ $type_name = 'page';
+ $field_name = 'test_file_field';
+ $this->createFileField($field_name, $type_name);
+
+ $test_file = $this->getTestFile('text');
+ foreach (array('nojs', 'js') as $type) {
+ // Create a temporary file owned by the anonymous victim user. This will be
+ // as if they had uploaded the file, but not saved the node they were
+ // editing or creating.
+ $victim_tmp_file = $this->createTemporaryFile('some text', $victim_uid);
+ $victim_tmp_file = file_load($victim_tmp_file->fid);
+ $this->assertTrue($victim_tmp_file->status != FILE_STATUS_PERMANENT, 'New file saved to disk is temporary.');
+ $this->assertFalse(empty($victim_tmp_file->fid), 'New file has a fid');
+ $this->assertEqual($victim_uid, $victim_tmp_file->uid, 'New file belongs to the victim user');
+
+ // Have attacker create a new node with a different uploaded file and
+ // ensure it got uploaded successfully.
+ // @todo Can we test AJAX? See https://www.drupal.org/node/2538260
+ $edit = array(
+ 'title' => $type . '-title',
+ );
+
+ // Attach a file to a node.
+ $langcode = LANGUAGE_NONE;
+ $edit['files[' . $field_name . '_' . $langcode . '_0]'] = drupal_realpath($test_file->uri);
+ $this->drupalPost("node/add/$type_name", $edit, 'Save');
+ $node = $this->drupalGetNodeByTitle($edit['title']);
+ $node_file = file_load($node->{$field_name}[$langcode][0]['fid']);
+ $this->assertFileExists($node_file, 'New file saved to disk on node creation.');
+ $this->assertEqual($attacker_uid, $node_file->uid, 'New file belongs to the attacker.');
+
+ // Ensure the file can be downloaded.
+ $this->drupalGet(file_create_url($node_file->uri));
+ $this->assertResponse(200, 'Confirmed that the generated URL is correct by downloading the shipped file.');
+
+ // "Click" the remove button (emulating either a nojs or js submission).
+ // In this POST request, the attacker "guesses" the fid of the victim's
+ // temporary file and uses that to remove this file.
+ $this->drupalGet('node/' . $node->nid . '/edit');
+ switch ($type) {
+ case 'nojs':
+ $this->drupalPost(NULL, array("{$field_name}[$langcode][0][fid]" => (string) $victim_tmp_file->fid), 'Remove');
+ break;
+ case 'js':
+ $button = $this->xpath('//input[@type="submit" and @value="Remove"]');
+ $this->drupalPostAJAX(NULL, array("{$field_name}[$langcode][0][fid]" => (string) $victim_tmp_file->fid), array((string) $button[0]['name'] => (string) $button[0]['value']));
+ break;
+ }
+
+ // The victim's temporary file should not be removed by the attacker's
+ // POST request.
+ $this->assertFileExists($victim_tmp_file);
+ }
+ }
+
+ /**
* Tests upload and remove buttons for multiple multi-valued File fields.
*/
function testMultiValuedWidget() {
diff -Naur drupal-7.42/modules/file/tests/file_module_test.info drupal-7.43/modules/file/tests/file_module_test.info
--- drupal-7.42/modules/file/tests/file_module_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/file/tests/file_module_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/filter/filter.info drupal-7.43/modules/filter/filter.info
--- drupal-7.42/modules/filter/filter.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/filter/filter.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
required = TRUE
configure = admin/config/content/formats
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/forum/forum.info drupal-7.43/modules/forum/forum.info
--- drupal-7.42/modules/forum/forum.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/forum/forum.info 2016-02-24 20:51:46.000000000 +0100
@@ -9,8 +9,8 @@
configure = admin/structure/forum
stylesheets[all][] = forum.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/help/help.info drupal-7.43/modules/help/help.info
--- drupal-7.42/modules/help/help.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/help/help.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = help.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/image/image.info drupal-7.43/modules/image/image.info
--- drupal-7.42/modules/image/image.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/image/image.info 2016-02-24 20:51:46.000000000 +0100
@@ -7,8 +7,8 @@
files[] = image.test
configure = admin/config/media/image-styles
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/image/tests/image_module_test.info drupal-7.43/modules/image/tests/image_module_test.info
--- drupal-7.42/modules/image/tests/image_module_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/image/tests/image_module_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
files[] = image_module_test.module
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/locale/locale.info drupal-7.43/modules/locale/locale.info
--- drupal-7.42/modules/locale/locale.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/locale/locale.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
files[] = locale.test
configure = admin/config/regional/language
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/locale/tests/locale_test.info drupal-7.43/modules/locale/tests/locale_test.info
--- drupal-7.42/modules/locale/tests/locale_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/locale/tests/locale_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
version = VERSION
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/menu/menu.info drupal-7.43/modules/menu/menu.info
--- drupal-7.42/modules/menu/menu.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/menu/menu.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
files[] = menu.test
configure = admin/structure/menu
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/node/node.info drupal-7.43/modules/node/node.info
--- drupal-7.42/modules/node/node.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/node/node.info 2016-02-24 20:51:46.000000000 +0100
@@ -9,8 +9,8 @@
configure = admin/structure/types
stylesheets[all][] = node.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/node/tests/node_access_test.info drupal-7.43/modules/node/tests/node_access_test.info
--- drupal-7.42/modules/node/tests/node_access_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/node/tests/node_access_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/node/tests/node_test.info drupal-7.43/modules/node/tests/node_test.info
--- drupal-7.42/modules/node/tests/node_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/node/tests/node_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/node/tests/node_test_exception.info drupal-7.43/modules/node/tests/node_test_exception.info
--- drupal-7.42/modules/node/tests/node_test_exception.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/node/tests/node_test_exception.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/openid/openid.info drupal-7.43/modules/openid/openid.info
--- drupal-7.42/modules/openid/openid.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/openid/openid.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = openid.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/openid/tests/openid_test.info drupal-7.43/modules/openid/tests/openid_test.info
--- drupal-7.42/modules/openid/tests/openid_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/openid/tests/openid_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
dependencies[] = openid
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/overlay/overlay.info drupal-7.43/modules/overlay/overlay.info
--- drupal-7.42/modules/overlay/overlay.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/overlay/overlay.info 2016-02-24 20:51:46.000000000 +0100
@@ -4,8 +4,8 @@
version = VERSION
core = 7.x
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/path/path.info drupal-7.43/modules/path/path.info
--- drupal-7.42/modules/path/path.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/path/path.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
files[] = path.test
configure = admin/config/search/path
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/php/php.info drupal-7.43/modules/php/php.info
--- drupal-7.42/modules/php/php.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/php/php.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = php.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/poll/poll.info drupal-7.43/modules/poll/poll.info
--- drupal-7.42/modules/poll/poll.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/poll/poll.info 2016-02-24 20:51:46.000000000 +0100
@@ -6,8 +6,8 @@
files[] = poll.test
stylesheets[all][] = poll.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/profile/profile.info drupal-7.43/modules/profile/profile.info
--- drupal-7.42/modules/profile/profile.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/profile/profile.info 2016-02-24 20:51:46.000000000 +0100
@@ -11,8 +11,8 @@
; See user_system_info_alter().
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/rdf/rdf.info drupal-7.43/modules/rdf/rdf.info
--- drupal-7.42/modules/rdf/rdf.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/rdf/rdf.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
files[] = rdf.test
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/rdf/tests/rdf_test.info drupal-7.43/modules/rdf/tests/rdf_test.info
--- drupal-7.42/modules/rdf/tests/rdf_test.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/rdf/tests/rdf_test.info 2016-02-24 20:51:46.000000000 +0100
@@ -5,8 +5,8 @@
core = 7.x
hidden = TRUE
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"
+datestamp = "1456343506"
diff -Naur drupal-7.42/modules/search/search.info drupal-7.43/modules/search/search.info
--- drupal-7.42/modules/search/search.info 2016-02-03 17:45:55.000000000 +0100
+++ drupal-7.43/modules/search/search.info 2016-02-24 20:51:46.000000000 +0100
@@ -8,8 +8,8 @@
configure = admin/config/search/settings
stylesheets[all][] = search.css
-; Information added by Drupal.org packaging script on 2016-02-03
-version = "7.42"
+; Information added by Drupal.org packaging script on 2016-02-24
+version = "7.43"
project = "drupal"
-datestamp = "1454517955"