codesentry-semgrep-rules 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/rules/owasp.yml CHANGED
@@ -17122,6 +17122,138 @@ rules:
17122
17122
  pattern-sanitizers:
17123
17123
  - pattern: params.merge(:only_path => true)
17124
17124
  - pattern: params.merge(:host => ...)
17125
+ - id: ruby.rails.security.audit.xss.avoid-render-dynamic-path.avoid-render-dynamic-path
17126
+ metadata:
17127
+ owasp:
17128
+ - A05:2017 - Broken Access Control
17129
+ - A01:2021 - Broken Access Control
17130
+ - A01:2025 - Broken Access Control
17131
+ cwe:
17132
+ - 'CWE-22: Improper Limitation of a Pathname to a Restricted Directory (''Path
17133
+ Traversal'')'
17134
+ references:
17135
+ - https://brakemanscanner.org/docs/warning_types/dynamic_render_paths/
17136
+ category: security
17137
+ technology:
17138
+ - rails
17139
+ cwe2022-top25: true
17140
+ cwe2021-top25: true
17141
+ subcategory:
17142
+ - vuln
17143
+ likelihood: HIGH
17144
+ impact: MEDIUM
17145
+ confidence: MEDIUM
17146
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17147
+ vulnerability_class:
17148
+ - Path Traversal
17149
+ source: https://semgrep.dev/r/ruby.rails.security.audit.xss.avoid-render-dynamic-path.avoid-render-dynamic-path
17150
+ shortlink: https://sg.run/GO2n
17151
+ semgrep.dev:
17152
+ rule:
17153
+ r_id: 13592
17154
+ rv_id: 1263635
17155
+ rule_id: 6JU1bL
17156
+ version_id: bZT53p0
17157
+ url: https://semgrep.dev/playground/r/bZT53p0/ruby.rails.security.audit.xss.avoid-render-dynamic-path.avoid-render-dynamic-path
17158
+ origin: community
17159
+ message: Avoid rendering user input. It may be possible for a malicious user to
17160
+ input a path that lets them access a template they shouldn't. To prevent this,
17161
+ check dynamic template paths against a predefined allowlist to make sure it's
17162
+ an allowed template.
17163
+ languages:
17164
+ - ruby
17165
+ severity: WARNING
17166
+ mode: taint
17167
+ pattern-sources:
17168
+ - pattern: params
17169
+ - pattern: cookies
17170
+ - pattern: request.env
17171
+ pattern-sinks:
17172
+ - patterns:
17173
+ - pattern-inside: render($X => $INPUT, ...)
17174
+ - pattern: $INPUT
17175
+ - metavariable-pattern:
17176
+ metavariable: $X
17177
+ pattern-either:
17178
+ - pattern: action
17179
+ - pattern: template
17180
+ - pattern: partial
17181
+ - pattern: file
17182
+ - id: python.lang.security.audit.insecure-file-permissions.insecure-file-permissions
17183
+ languages:
17184
+ - python
17185
+ severity: WARNING
17186
+ metadata:
17187
+ category: security
17188
+ owasp:
17189
+ - A01:2021 - Broken Access Control
17190
+ - A01:2025 - Broken Access Control
17191
+ cwe:
17192
+ - 'CWE-276: Incorrect Default Permissions'
17193
+ technology:
17194
+ - python
17195
+ references:
17196
+ - https://owasp.org/Top10/A01_2021-Broken_Access_Control
17197
+ cwe2022-top25: true
17198
+ cwe2021-top25: true
17199
+ subcategory:
17200
+ - vuln
17201
+ likelihood: LOW
17202
+ impact: MEDIUM
17203
+ confidence: MEDIUM
17204
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17205
+ vulnerability_class:
17206
+ - Improper Authorization
17207
+ source: https://semgrep.dev/r/python.lang.security.audit.insecure-file-permissions.insecure-file-permissions
17208
+ shortlink: https://sg.run/AXY4
17209
+ semgrep.dev:
17210
+ rule:
17211
+ r_id: 13594
17212
+ rv_id: 1263482
17213
+ rule_id: zdUYqR
17214
+ version_id: O9Tpxqr
17215
+ url: https://semgrep.dev/playground/r/O9Tpxqr/python.lang.security.audit.insecure-file-permissions.insecure-file-permissions
17216
+ origin: community
17217
+ message: These permissions `$BITS` are widely permissive and grant access to more
17218
+ people than may be necessary. A good default is `0o644` which gives read and write
17219
+ access to yourself and read access to everyone else.
17220
+ patterns:
17221
+ - pattern-inside: os.$METHOD(...)
17222
+ - metavariable-pattern:
17223
+ metavariable: $METHOD
17224
+ patterns:
17225
+ - pattern-either:
17226
+ - pattern: chmod
17227
+ - pattern: lchmod
17228
+ - pattern: fchmod
17229
+ - pattern-either:
17230
+ - patterns:
17231
+ - pattern: os.$METHOD($FILE, $BITS, ...)
17232
+ - metavariable-comparison:
17233
+ metavariable: $BITS
17234
+ comparison: $BITS >= 0o650 and $BITS < 0o100000
17235
+ - patterns:
17236
+ - pattern: os.$METHOD($FILE, $BITS)
17237
+ - metavariable-comparison:
17238
+ metavariable: $BITS
17239
+ comparison: $BITS >= 0o100650
17240
+ - patterns:
17241
+ - pattern: os.$METHOD($FILE, $BITS, ...)
17242
+ - metavariable-pattern:
17243
+ metavariable: $BITS
17244
+ patterns:
17245
+ - pattern-either:
17246
+ - pattern: <... stat.S_IWGRP ...>
17247
+ - pattern: <... stat.S_IXGRP ...>
17248
+ - pattern: <... stat.S_IWOTH ...>
17249
+ - pattern: <... stat.S_IXOTH ...>
17250
+ - pattern: <... stat.S_IRWXO ...>
17251
+ - pattern: <... stat.S_IRWXG ...>
17252
+ - patterns:
17253
+ - pattern: os.$METHOD($FILE, $EXPR | $MOD, ...)
17254
+ - metavariable-comparison:
17255
+ metavariable: $MOD
17256
+ comparison: $MOD == 0o111
17125
17257
  - id: php.doctrine.security.audit.doctrine-orm-dangerous-query.doctrine-orm-dangerous-query
17126
17258
  languages:
17127
17259
  - php
@@ -17452,49 +17584,54 @@ rules:
17452
17584
  regex: ^(GET|HEAD|POST|POSTFORM)$
17453
17585
  - focus-metavariable: $URL
17454
17586
  severity: WARNING
17455
- - id: go.lang.security.injection.raw-html-format.raw-html-format
17587
+ - id: go.lang.security.injection.tainted-sql-string.tainted-sql-string
17456
17588
  languages:
17457
17589
  - go
17458
- severity: WARNING
17459
- message: Detected user input flowing into a manually constructed HTML string. You
17460
- may be accidentally bypassing secure methods of rendering HTML by manually constructing
17461
- HTML and this could create a cross-site scripting vulnerability, which could let
17462
- attackers steal sensitive user data. Use the `html/template` package which will
17463
- safely render HTML instead, or inspect that the HTML is rendered safely.
17590
+ message: User data flows into this manually-constructed SQL string. User data can
17591
+ be safely inserted into SQL strings using prepared statements or an object-relational
17592
+ mapper (ORM). Manually-constructed SQL strings is a possible indicator of SQL
17593
+ injection, which could let an attacker steal or manipulate data from the database.
17594
+ Instead, use prepared statements (`db.Query("SELECT * FROM t WHERE id = ?", id)`)
17595
+ or a safe library.
17596
+ options:
17597
+ interfile: true
17464
17598
  metadata:
17465
17599
  cwe:
17466
- - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
17467
- Scripting'')'
17600
+ - 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command
17601
+ (''SQL Injection'')'
17468
17602
  owasp:
17469
- - A07:2017 - Cross-Site Scripting (XSS)
17603
+ - A01:2017 - Injection
17470
17604
  - A03:2021 - Injection
17471
17605
  - A05:2025 - Injection
17606
+ references:
17607
+ - https://golang.org/doc/database/sql-injection
17608
+ - https://www.stackhawk.com/blog/golang-sql-injection-guide-examples-and-prevention/
17472
17609
  category: security
17473
17610
  technology:
17474
17611
  - go
17475
- references:
17476
- - https://blogtitle.github.io/robn-go-security-pearls-cross-site-scripting-xss/
17477
- confidence: MEDIUM
17612
+ confidence: HIGH
17478
17613
  cwe2022-top25: true
17479
17614
  cwe2021-top25: true
17480
17615
  subcategory:
17481
17616
  - vuln
17482
17617
  likelihood: HIGH
17483
17618
  impact: MEDIUM
17619
+ interfile: true
17484
17620
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17485
17621
  vulnerability_class:
17486
- - Cross-Site-Scripting (XSS)
17487
- source: https://semgrep.dev/r/go.lang.security.injection.raw-html-format.raw-html-format
17488
- shortlink: https://sg.run/3r1G
17622
+ - SQL Injection
17623
+ source: https://semgrep.dev/r/go.lang.security.injection.tainted-sql-string.tainted-sql-string
17624
+ shortlink: https://sg.run/PbEq
17489
17625
  semgrep.dev:
17490
17626
  rule:
17491
- r_id: 14443
17492
- rv_id: 1262968
17493
- rule_id: PeUonQ
17494
- version_id: 1QTyp2p
17495
- url: https://semgrep.dev/playground/r/1QTyp2p/go.lang.security.injection.raw-html-format.raw-html-format
17627
+ r_id: 14689
17628
+ rv_id: 1409388
17629
+ rule_id: PeUoqy
17630
+ version_id: nWTQ5qD
17631
+ url: https://semgrep.dev/playground/r/nWTQ5qD/go.lang.security.injection.tainted-sql-string.tainted-sql-string
17496
17632
  origin: community
17497
17633
  mode: taint
17634
+ severity: ERROR
17498
17635
  pattern-sources:
17499
17636
  - patterns:
17500
17637
  - pattern-either:
@@ -17505,217 +17642,390 @@ rules:
17505
17642
  - metavariable-regex:
17506
17643
  metavariable: $ANYTHING
17507
17644
  regex: ^(BasicAuth|Body|Cookie|Cookies|Form|FormValue|GetBody|Host|MultipartReader|ParseForm|ParseMultipartForm|PostForm|PostFormValue|Referer|RequestURI|Trailer|TransferEncoding|UserAgent|URL)$
17508
- pattern-sanitizers:
17509
- - pattern: html.EscapeString(...)
17510
17645
  pattern-sinks:
17511
17646
  - patterns:
17512
17647
  - pattern-either:
17513
- - pattern: fmt.Printf("$HTMLSTR", ...)
17514
- - pattern: fmt.Sprintf("$HTMLSTR", ...)
17515
- - pattern: fmt.Fprintf($W, "$HTMLSTR", ...)
17516
- - pattern: '"$HTMLSTR" + ...'
17517
- - metavariable-pattern:
17518
- metavariable: $HTMLSTR
17519
- language: generic
17520
- pattern: <$TAG ...
17521
- - id: ruby.rails.security.injection.raw-html-format.raw-html-format
17648
+ - patterns:
17649
+ - pattern-either:
17650
+ - pattern: |
17651
+ "$SQLSTR" + ...
17652
+ - patterns:
17653
+ - pattern-inside: |
17654
+ $VAR = "$SQLSTR";
17655
+ ...
17656
+ - pattern: $VAR += ...
17657
+ - patterns:
17658
+ - pattern-inside: |
17659
+ var $SB strings.Builder
17660
+ ...
17661
+ - pattern-inside: |
17662
+ $SB.WriteString("$SQLSTR")
17663
+ ...
17664
+ $SB.String(...)
17665
+ - pattern: |
17666
+ $SB.WriteString(...)
17667
+ - metavariable-regex:
17668
+ metavariable: $SQLSTR
17669
+ regex: (?i)(select|delete|insert|create|update|alter|drop).*
17670
+ - patterns:
17671
+ - pattern-either:
17672
+ - pattern: fmt.Fprintf($F, "$SQLSTR", ...)
17673
+ - pattern: fmt.Sprintf("$SQLSTR", ...)
17674
+ - pattern: fmt.Printf("$SQLSTR", ...)
17675
+ - metavariable-regex:
17676
+ metavariable: $SQLSTR
17677
+ regex: \s*(?i)(select|delete|insert|create|update|alter|drop)\b.*%(v|s|q).*
17678
+ pattern-sanitizers:
17679
+ - pattern-either:
17680
+ - pattern: strconv.Atoi(...)
17681
+ - pattern: |
17682
+ ($X: bool)
17683
+ - id: java.lang.security.audit.md5-used-as-password.md5-used-as-password
17522
17684
  languages:
17523
- - ruby
17685
+ - java
17524
17686
  severity: WARNING
17525
- message: Detected user input flowing into a manually constructed HTML string. You
17526
- may be accidentally bypassing secure methods of rendering HTML by manually constructing
17527
- HTML and this could create a cross-site scripting vulnerability, which could let
17528
- attackers steal sensitive user data. Use the `render template` and make template
17529
- files which will safely render HTML instead, or inspect that the HTML is absolutely
17530
- rendered safely with a function like `sanitize`.
17687
+ message: It looks like MD5 is used as a password hash. MD5 is not considered a secure
17688
+ password hash because it can be cracked by an attacker in a short amount of time.
17689
+ Use a suitable password hashing function such as PBKDF2 or bcrypt. You can use
17690
+ `javax.crypto.SecretKeyFactory` with `SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1")`
17691
+ or, if using Spring, `org.springframework.security.crypto.bcrypt`.
17531
17692
  metadata:
17532
- cwe:
17533
- - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
17534
- Scripting'')'
17535
- owasp:
17536
- - A07:2017 - Cross-Site Scripting (XSS)
17537
- - A03:2021 - Injection
17538
- - A05:2025 - Injection
17539
17693
  category: security
17540
17694
  technology:
17541
- - rails
17695
+ - java
17696
+ - md5
17542
17697
  references:
17543
- - https://www.netsparker.com/blog/web-security/preventing-xss-ruby-on-rails-web-applications/
17544
- - https://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html
17545
- cwe2022-top25: true
17546
- cwe2021-top25: true
17547
- subcategory:
17548
- - vuln
17549
- likelihood: HIGH
17698
+ - https://tools.ietf.org/id/draft-lvelvindron-tls-md5-sha1-deprecate-01.html
17699
+ - https://github.com/returntocorp/semgrep-rules/issues/1609
17700
+ - https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory
17701
+ - https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoder.html
17702
+ owasp:
17703
+ - A03:2017 - Sensitive Data Exposure
17704
+ - A02:2021 - Cryptographic Failures
17705
+ - A04:2025 - Cryptographic Failures
17706
+ cwe:
17707
+ - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
17708
+ subcategory:
17709
+ - vuln
17710
+ likelihood: HIGH
17550
17711
  impact: MEDIUM
17551
17712
  confidence: MEDIUM
17552
17713
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17553
17714
  vulnerability_class:
17554
- - Cross-Site-Scripting (XSS)
17555
- source: https://semgrep.dev/r/ruby.rails.security.injection.raw-html-format.raw-html-format
17556
- shortlink: https://sg.run/b2JQ
17715
+ - Cryptographic Issues
17716
+ source: https://semgrep.dev/r/java.lang.security.audit.md5-used-as-password.md5-used-as-password
17717
+ shortlink: https://sg.run/JxEQ
17557
17718
  semgrep.dev:
17558
17719
  rule:
17559
- r_id: 14470
17560
- rv_id: 1409408
17561
- rule_id: kxUwZX
17562
- version_id: qkTvgYY
17563
- url: https://semgrep.dev/playground/r/qkTvgYY/ruby.rails.security.injection.raw-html-format.raw-html-format
17720
+ r_id: 14690
17721
+ rv_id: 1263029
17722
+ rule_id: JDULAW
17723
+ version_id: bZT53QB
17724
+ url: https://semgrep.dev/playground/r/bZT53QB/java.lang.security.audit.md5-used-as-password.md5-used-as-password
17564
17725
  origin: community
17565
17726
  mode: taint
17566
- pattern-sanitizers:
17567
- - pattern-either:
17568
- - pattern: sanitize(...)
17569
- - pattern: strip_tags(...)
17570
17727
  pattern-sources:
17571
17728
  - patterns:
17572
- - pattern-either:
17573
- - pattern: params
17574
- - pattern: request
17729
+ - pattern-inside: |
17730
+ $TYPE $MD = MessageDigest.getInstance("MD5");
17731
+ ...
17732
+ - pattern: $MD.digest(...);
17575
17733
  pattern-sinks:
17576
17734
  - patterns:
17735
+ - pattern: $MODEL.$METHOD(...);
17736
+ - metavariable-regex:
17737
+ metavariable: $METHOD
17738
+ regex: (?i)(.*password.*)
17739
+ - id: javascript.express.security.injection.raw-html-format.raw-html-format
17740
+ message: User data flows into the host portion of this manually-constructed HTML.
17741
+ This can introduce a Cross-Site-Scripting (XSS) vulnerability if this comes from
17742
+ user-provided input. Consider using a sanitization library such as DOMPurify to
17743
+ sanitize the HTML within.
17744
+ metadata:
17745
+ cwe:
17746
+ - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
17747
+ Scripting'')'
17748
+ owasp:
17749
+ - A07:2017 - Cross-Site Scripting (XSS)
17750
+ - A03:2021 - Injection
17751
+ - A05:2025 - Injection
17752
+ references:
17753
+ - https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
17754
+ category: security
17755
+ technology:
17756
+ - express
17757
+ cwe2022-top25: true
17758
+ cwe2021-top25: true
17759
+ subcategory:
17760
+ - vuln
17761
+ likelihood: HIGH
17762
+ impact: MEDIUM
17763
+ confidence: MEDIUM
17764
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17765
+ vulnerability_class:
17766
+ - Cross-Site-Scripting (XSS)
17767
+ source: https://semgrep.dev/r/javascript.express.security.injection.raw-html-format.raw-html-format
17768
+ shortlink: https://sg.run/5DO3
17769
+ semgrep.dev:
17770
+ rule:
17771
+ r_id: 14691
17772
+ rv_id: 1263175
17773
+ rule_id: 5rUL0X
17774
+ version_id: NdTzyQv
17775
+ url: https://semgrep.dev/playground/r/NdTzyQv/javascript.express.security.injection.raw-html-format.raw-html-format
17776
+ origin: community
17777
+ languages:
17778
+ - javascript
17779
+ - typescript
17780
+ severity: WARNING
17781
+ mode: taint
17782
+ pattern-sources:
17783
+ - label: EXPRESS
17784
+ patterns:
17577
17785
  - pattern-either:
17786
+ - pattern-inside: function ... ($REQ, $RES) {...}
17787
+ - pattern-inside: function ... ($REQ, $RES, $NEXT) {...}
17578
17788
  - patterns:
17579
- - pattern: |
17580
- $HTMLSTR
17581
- - pattern-regex: <\w+.*
17789
+ - pattern-either:
17790
+ - pattern-inside: $APP.$METHOD(..., function $FUNC($REQ, $RES) {...})
17791
+ - pattern-inside: $APP.$METHOD(..., function $FUNC($REQ, $RES, $NEXT) {...})
17792
+ - metavariable-regex:
17793
+ metavariable: $METHOD
17794
+ regex: ^(get|post|put|head|delete|options)$
17795
+ - pattern-either:
17796
+ - pattern: $REQ.query
17797
+ - pattern: $REQ.body
17798
+ - pattern: $REQ.params
17799
+ - pattern: $REQ.cookies
17800
+ - pattern: $REQ.headers
17801
+ - label: EXPRESSTS
17802
+ patterns:
17803
+ - pattern-either:
17804
+ - pattern-inside: |
17805
+ ({ $REQ }: Request,$RES: Response, $NEXT: NextFunction) =>
17806
+ {...}
17807
+ - pattern-inside: |
17808
+ ({ $REQ }: Request,$RES: Response) => {...}
17809
+ - focus-metavariable: $REQ
17810
+ - pattern-either:
17811
+ - pattern: params
17812
+ - pattern: query
17813
+ - pattern: cookies
17814
+ - pattern: headers
17815
+ - pattern: body
17816
+ - label: CLEAN
17817
+ by-side-effect: true
17818
+ patterns:
17819
+ - pattern-either:
17820
+ - pattern: $A($SOURCE)
17821
+ - pattern: $SANITIZE. ... .$A($SOURCE)
17822
+ - pattern: $A. ... .$SANITIZE($SOURCE)
17823
+ - focus-metavariable: $SOURCE
17824
+ - metavariable-regex:
17825
+ metavariable: $A
17826
+ regex: (?i)(.*valid|.*sanitiz)
17827
+ pattern-sinks:
17828
+ - requires: (EXPRESS and not CLEAN) or (EXPRESSTS and not CLEAN)
17829
+ patterns:
17830
+ - pattern-either:
17582
17831
  - patterns:
17583
17832
  - pattern-either:
17584
- - pattern: Kernel::sprintf("$HTMLSTR", ...)
17585
- - pattern: |
17586
- "$HTMLSTR" + $EXPR
17587
- - pattern: |
17588
- "$HTMLSTR" % $EXPR
17833
+ - pattern: '"$HTMLSTR" + $EXPR'
17834
+ - pattern: '"$HTMLSTR".concat(...)'
17835
+ - pattern: util.format($HTMLSTR, ...)
17589
17836
  - metavariable-pattern:
17590
17837
  metavariable: $HTMLSTR
17591
17838
  language: generic
17592
17839
  pattern: <$TAG ...
17593
- - id: bash.curl.security.curl-eval.curl-eval
17594
- severity: WARNING
17595
- languages:
17596
- - bash
17597
- message: Data is being eval'd from a `curl` command. An attacker with control of
17598
- the server in the `curl` command could inject malicious code into the `eval`,
17599
- resulting in a system comrpomise. Avoid eval'ing untrusted data if you can. If
17600
- you must do this, consider checking the SHA sum of the content returned by the
17601
- server to verify its integrity.
17840
+ - patterns:
17841
+ - pattern: |
17842
+ `...`
17843
+ - pattern-regex: |
17844
+ .*<\w+.*
17845
+ - id: kotlin.lang.security.ecb-cipher.ecb-cipher
17602
17846
  metadata:
17603
- owasp:
17604
- - A03:2021 - Injection
17605
- - A05:2025 - Injection
17606
17847
  cwe:
17607
- - 'CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code
17608
- (''Eval Injection'')'
17848
+ - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
17849
+ owasp:
17850
+ - A03:2017 - Sensitive Data Exposure
17851
+ - A02:2021 - Cryptographic Failures
17852
+ - A04:2025 - Cryptographic Failures
17853
+ source-rule-url: https://find-sec-bugs.github.io/bugs.htm#ECB_MODE
17609
17854
  category: security
17610
17855
  technology:
17611
- - bash
17612
- - curl
17613
- confidence: MEDIUM
17856
+ - kotlin
17614
17857
  references:
17615
- - https://owasp.org/Top10/A03_2021-Injection
17858
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
17616
17859
  subcategory:
17617
17860
  - vuln
17618
- likelihood: MEDIUM
17861
+ likelihood: LOW
17619
17862
  impact: MEDIUM
17863
+ confidence: MEDIUM
17620
17864
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17621
17865
  vulnerability_class:
17622
- - Code Injection
17623
- source: https://semgrep.dev/r/bash.curl.security.curl-eval.curl-eval
17624
- shortlink: https://sg.run/0yqJ
17866
+ - Cryptographic Issues
17867
+ source: https://semgrep.dev/r/kotlin.lang.security.ecb-cipher.ecb-cipher
17868
+ shortlink: https://sg.run/DzLj
17625
17869
  semgrep.dev:
17626
17870
  rule:
17627
- r_id: 14554
17628
- rv_id: 1262601
17629
- rule_id: KxU7Rq
17630
- version_id: JdTzxL2
17631
- url: https://semgrep.dev/playground/r/JdTzxL2/bash.curl.security.curl-eval.curl-eval
17871
+ r_id: 14696
17872
+ rv_id: 1263263
17873
+ rule_id: DbU1Zd
17874
+ version_id: YDTZexg
17875
+ url: https://semgrep.dev/playground/r/YDTZexg/kotlin.lang.security.ecb-cipher.ecb-cipher
17632
17876
  origin: community
17633
- mode: taint
17634
- pattern-sources:
17635
- - pattern: |
17636
- $(curl ...)
17637
- - pattern: |
17638
- `curl ...`
17639
- pattern-sinks:
17640
- - pattern: eval ...
17641
- - id: python.flask.security.injection.tainted-url-host.tainted-url-host
17877
+ message: Cipher in ECB mode is detected. ECB mode produces the same output for the
17878
+ same input each time which allows an attacker to intercept and replay the data.
17879
+ Further, ECB mode does not provide any integrity checking. See https://find-sec-bugs.github.io/bugs.htm#CIPHER_INTEGRITY.
17880
+ severity: WARNING
17642
17881
  languages:
17643
- - python
17644
- message: User data flows into the host portion of this manually-constructed URL.
17645
- This could allow an attacker to send data to their own server, potentially exposing
17646
- sensitive data such as cookies or authorization information sent with this request.
17647
- They could also probe internal servers or other resources that the server running
17648
- this code can access. (This is called server-side request forgery, or SSRF.) Do
17649
- not allow arbitrary hosts. Instead, create an allowlist for approved hosts, or
17650
- hardcode the correct host.
17882
+ - kt
17883
+ patterns:
17884
+ - pattern-either:
17885
+ - pattern: |
17886
+ val $VAR : Cipher = $CIPHER.getInstance($MODE)
17887
+ - pattern: |
17888
+ var $VAR : Cipher = $CIPHER.getInstance($MODE)
17889
+ - pattern: |
17890
+ val $VAR = $CIPHER.getInstance($MODE)
17891
+ - pattern: |
17892
+ var $VAR = $CIPHER.getInstance($MODE)
17893
+ - metavariable-regex:
17894
+ metavariable: $MODE
17895
+ regex: .*ECB.*
17896
+ - id: kotlin.lang.security.no-null-cipher.no-null-cipher
17897
+ pattern: NullCipher(...)
17651
17898
  metadata:
17652
17899
  cwe:
17653
- - 'CWE-918: Server-Side Request Forgery (SSRF)'
17900
+ - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
17654
17901
  owasp:
17655
- - A10:2021 - Server-Side Request Forgery (SSRF)
17656
- - A01:2025 - Broken Access Control
17657
- references:
17658
- - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
17902
+ - A03:2017 - Sensitive Data Exposure
17903
+ - A02:2021 - Cryptographic Failures
17904
+ - A04:2025 - Cryptographic Failures
17905
+ source-rule-url: https://find-sec-bugs.github.io/bugs.htm#NULL_CIPHER
17906
+ asvs:
17907
+ section: V6 Stored Cryptography Verification Requirements
17908
+ control_id: 6.2.5 Insecure Algorithm
17909
+ control_url: https://github.com/OWASP/ASVS/blob/master/4.0/en/0x14-V6-Cryptography.md#v62-algorithms
17910
+ version: '4'
17659
17911
  category: security
17660
17912
  technology:
17661
- - flask
17662
- cwe2022-top25: true
17663
- cwe2021-top25: true
17913
+ - kotlin
17914
+ references:
17915
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
17664
17916
  subcategory:
17665
17917
  - vuln
17918
+ likelihood: LOW
17666
17919
  impact: MEDIUM
17667
- likelihood: MEDIUM
17668
17920
  confidence: MEDIUM
17669
17921
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17670
17922
  vulnerability_class:
17671
- - Server-Side Request Forgery (SSRF)
17672
- source: https://semgrep.dev/r/python.flask.security.injection.tainted-url-host.tainted-url-host
17673
- shortlink: https://sg.run/RXpK
17923
+ - Cryptographic Issues
17924
+ source: https://semgrep.dev/r/kotlin.lang.security.no-null-cipher.no-null-cipher
17925
+ shortlink: https://sg.run/0ywb
17674
17926
  semgrep.dev:
17675
17927
  rule:
17676
- r_id: 14649
17677
- rv_id: 1409403
17678
- rule_id: ReU3Wb
17679
- version_id: BjTy42w
17680
- url: https://semgrep.dev/playground/r/BjTy42w/python.flask.security.injection.tainted-url-host.tainted-url-host
17928
+ r_id: 14698
17929
+ rv_id: 1263265
17930
+ rule_id: 0oU2Yy
17931
+ version_id: o5TbDPj
17932
+ url: https://semgrep.dev/playground/r/o5TbDPj/kotlin.lang.security.no-null-cipher.no-null-cipher
17933
+ origin: community
17934
+ message: 'NullCipher was detected. This will not encrypt anything; the cipher text
17935
+ will be the same as the plain text. Use a valid, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING").
17936
+ See https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for
17937
+ more information.'
17938
+ severity: WARNING
17939
+ languages:
17940
+ - kt
17941
+ - scala
17942
+ - id: kotlin.lang.security.use-of-md5.use-of-md5
17943
+ message: Detected MD5 hash algorithm which is considered insecure. MD5 is not collision
17944
+ resistant and is therefore not suitable as a cryptographic signature. Use SHA256
17945
+ or SHA3 instead.
17946
+ languages:
17947
+ - kt
17948
+ severity: WARNING
17949
+ metadata:
17950
+ owasp:
17951
+ - A03:2017 - Sensitive Data Exposure
17952
+ - A02:2021 - Cryptographic Failures
17953
+ - A04:2025 - Cryptographic Failures
17954
+ cwe:
17955
+ - 'CWE-328: Use of Weak Hash'
17956
+ source-rule-url: https://find-sec-bugs.github.io/bugs.htm#WEAK_MESSAGE_DIGEST_MD5
17957
+ category: security
17958
+ technology:
17959
+ - kotlin
17960
+ references:
17961
+ - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
17962
+ subcategory:
17963
+ - vuln
17964
+ likelihood: LOW
17965
+ impact: MEDIUM
17966
+ confidence: MEDIUM
17967
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17968
+ vulnerability_class:
17969
+ - Insecure Hashing Algorithm
17970
+ source: https://semgrep.dev/r/kotlin.lang.security.use-of-md5.use-of-md5
17971
+ shortlink: https://sg.run/4eQx
17972
+ semgrep.dev:
17973
+ rule:
17974
+ r_id: 14700
17975
+ rv_id: 1263267
17976
+ rule_id: qNUXPj
17977
+ version_id: pZT03Jd
17978
+ url: https://semgrep.dev/playground/r/pZT03Jd/kotlin.lang.security.use-of-md5.use-of-md5
17979
+ origin: community
17980
+ pattern-either:
17981
+ - pattern: |
17982
+ java.security.MessageDigest.getInstance("MD5")
17983
+ - pattern: |
17984
+ org.apache.commons.codec.digest.DigestUtils.getMd5Digest()
17985
+ - id: python.flask.security.injection.tainted-sql-string.tainted-sql-string
17986
+ message: Detected user input used to manually construct a SQL string. This is usually
17987
+ bad practice because manual construction could accidentally result in a SQL injection.
17988
+ An attacker could use a SQL injection to steal or modify contents of the database.
17989
+ Instead, use a parameterized query which is available by default in most database
17990
+ engines. Alternatively, consider using an object-relational mapper (ORM) such
17991
+ as SQLAlchemy which will protect your queries.
17992
+ metadata:
17993
+ cwe:
17994
+ - 'CWE-704: Incorrect Type Conversion or Cast'
17995
+ owasp:
17996
+ - A01:2017 - Injection
17997
+ - A03:2021 - Injection
17998
+ - A05:2025 - Injection
17999
+ references:
18000
+ - https://docs.sqlalchemy.org/en/14/core/tutorial.html#using-textual-sql
18001
+ - https://www.tutorialspoint.com/sqlalchemy/sqlalchemy_quick_guide.htm
18002
+ - https://docs.sqlalchemy.org/en/14/core/tutorial.html#using-more-specific-text-with-table-expression-literal-column-and-expression-column
18003
+ category: security
18004
+ technology:
18005
+ - sqlalchemy
18006
+ - flask
18007
+ subcategory:
18008
+ - vuln
18009
+ impact: MEDIUM
18010
+ likelihood: MEDIUM
18011
+ confidence: MEDIUM
18012
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18013
+ vulnerability_class:
18014
+ - Improper Validation
18015
+ source: https://semgrep.dev/r/python.flask.security.injection.tainted-sql-string.tainted-sql-string
18016
+ shortlink: https://sg.run/JxZj
18017
+ semgrep.dev:
18018
+ rule:
18019
+ r_id: 14702
18020
+ rv_id: 1409402
18021
+ rule_id: YGUDKQ
18022
+ version_id: A8TEvb4
18023
+ url: https://semgrep.dev/playground/r/A8TEvb4/python.flask.security.injection.tainted-sql-string.tainted-sql-string
17681
18024
  origin: community
18025
+ severity: ERROR
18026
+ languages:
18027
+ - python
17682
18028
  mode: taint
17683
- pattern-sinks:
17684
- - patterns:
17685
- - pattern-either:
17686
- - patterns:
17687
- - pattern: '"$URLSTR" % ...'
17688
- - metavariable-pattern:
17689
- metavariable: $URLSTR
17690
- language: generic
17691
- patterns:
17692
- - pattern-either:
17693
- - pattern: $SCHEME://%s
17694
- - pattern: $SCHEME://%r
17695
- - patterns:
17696
- - pattern: '"$URLSTR".format(...)'
17697
- - metavariable-pattern:
17698
- metavariable: $URLSTR
17699
- language: generic
17700
- pattern: $SCHEME:// { ... }
17701
- - patterns:
17702
- - pattern: '"$URLSTR" + ...'
17703
- - metavariable-regex:
17704
- metavariable: $URLSTR
17705
- regex: .*://$
17706
- - patterns:
17707
- - pattern: f"$URLSTR{...}..."
17708
- - metavariable-regex:
17709
- metavariable: $URLSTR
17710
- regex: .*://$
17711
- - patterns:
17712
- - pattern-inside: |
17713
- $URL = "$URLSTR"
17714
- ...
17715
- - pattern: $URL += ...
17716
- - metavariable-regex:
17717
- metavariable: $URLSTR
17718
- regex: .*://$
17719
18029
  pattern-sources:
17720
18030
  - patterns:
17721
18031
  - pattern-either:
@@ -17726,17 +18036,87 @@ rules:
17726
18036
  def $FUNC(..., $ROUTEVAR, ...):
17727
18037
  ...
17728
18038
  - pattern: $ROUTEVAR
18039
+ pattern-sinks:
18040
+ - patterns:
18041
+ - pattern-either:
18042
+ - pattern: |
18043
+ "$SQLSTR" + ...
18044
+ - pattern: |
18045
+ "$SQLSTR" % ...
18046
+ - pattern: |
18047
+ "$SQLSTR".format(...)
18048
+ - pattern: |
18049
+ f"$SQLSTR{...}..."
18050
+ - metavariable-regex:
18051
+ metavariable: $SQLSTR
18052
+ regex: \s*(?i)(select|delete|insert|create|update|alter|drop)\b.*
18053
+ - id: python.lang.security.audit.md5-used-as-password.md5-used-as-password
17729
18054
  severity: WARNING
17730
- - id: go.lang.security.audit.md5-used-as-password.md5-used-as-password
18055
+ message: It looks like MD5 is used as a password hash. MD5 is not considered a secure
18056
+ password hash because it can be cracked by an attacker in a short amount of time.
18057
+ Use a suitable password hashing function such as scrypt. You can use `hashlib.scrypt`.
17731
18058
  languages:
17732
- - go
18059
+ - python
18060
+ metadata:
18061
+ cwe:
18062
+ - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
18063
+ owasp:
18064
+ - A03:2017 - Sensitive Data Exposure
18065
+ - A02:2021 - Cryptographic Failures
18066
+ - A04:2025 - Cryptographic Failures
18067
+ references:
18068
+ - https://tools.ietf.org/html/rfc6151
18069
+ - https://crypto.stackexchange.com/questions/44151/how-does-the-flame-malware-take-advantage-of-md5-collision
18070
+ - https://pycryptodome.readthedocs.io/en/latest/src/hash/sha3_256.html
18071
+ - https://security.stackexchange.com/questions/211/how-to-securely-hash-passwords
18072
+ - https://github.com/returntocorp/semgrep-rules/issues/1609
18073
+ - https://docs.python.org/3/library/hashlib.html#hashlib.scrypt
18074
+ category: security
18075
+ technology:
18076
+ - pycryptodome
18077
+ - hashlib
18078
+ - md5
18079
+ subcategory:
18080
+ - vuln
18081
+ likelihood: HIGH
18082
+ impact: LOW
18083
+ confidence: MEDIUM
18084
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18085
+ vulnerability_class:
18086
+ - Cryptographic Issues
18087
+ source: https://semgrep.dev/r/python.lang.security.audit.md5-used-as-password.md5-used-as-password
18088
+ shortlink: https://sg.run/5DwD
18089
+ semgrep.dev:
18090
+ rule:
18091
+ r_id: 14703
18092
+ rv_id: 1263504
18093
+ rule_id: 6JU1w1
18094
+ version_id: WrTqKDz
18095
+ url: https://semgrep.dev/playground/r/WrTqKDz/python.lang.security.audit.md5-used-as-password.md5-used-as-password
18096
+ origin: community
18097
+ mode: taint
18098
+ pattern-sources:
18099
+ - patterns:
18100
+ - pattern-either:
18101
+ - pattern: hashlib.md5
18102
+ - pattern: hashlib.new(..., name="MD5", ...)
18103
+ - pattern: Cryptodome.Hash.MD5
18104
+ - pattern: Crypto.Hash.MD5
18105
+ - pattern: cryptography.hazmat.primitives.hashes.MD5
18106
+ pattern-sinks:
18107
+ - patterns:
18108
+ - pattern: $FUNCTION(...)
18109
+ - metavariable-regex:
18110
+ metavariable: $FUNCTION
18111
+ regex: (?i)(.*password.*)
18112
+ - id: ruby.lang.security.md5-used-as-password.md5-used-as-password
18113
+ languages:
18114
+ - ruby
17733
18115
  severity: WARNING
17734
18116
  message: It looks like MD5 is used as a password hash. MD5 is not considered a secure
17735
18117
  password hash because it can be cracked by an attacker in a short amount of time.
17736
- Use a suitable password hashing function such as bcrypt. You can use the `golang.org/x/crypto/bcrypt`
17737
- package.
17738
- options:
17739
- interfile: true
18118
+ Instead, use a suitable password hashing function such as bcrypt. You can use
18119
+ the `bcrypt` gem.
17740
18120
  metadata:
17741
18121
  category: security
17742
18122
  technology:
@@ -17745,214 +18125,216 @@ rules:
17745
18125
  - https://tools.ietf.org/id/draft-lvelvindron-tls-md5-sha1-deprecate-01.html
17746
18126
  - https://security.stackexchange.com/questions/211/how-to-securely-hash-passwords
17747
18127
  - https://github.com/returntocorp/semgrep-rules/issues/1609
17748
- - https://pkg.go.dev/golang.org/x/crypto/bcrypt
17749
18128
  owasp:
17750
18129
  - A03:2017 - Sensitive Data Exposure
17751
18130
  - A02:2021 - Cryptographic Failures
17752
18131
  - A04:2025 - Cryptographic Failures
17753
18132
  cwe:
17754
18133
  - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
17755
- confidence: MEDIUM
17756
18134
  subcategory:
17757
18135
  - vuln
17758
- likelihood: MEDIUM
18136
+ likelihood: HIGH
17759
18137
  impact: MEDIUM
17760
- interfile: true
18138
+ confidence: MEDIUM
17761
18139
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17762
18140
  vulnerability_class:
17763
18141
  - Cryptographic Issues
17764
- source: https://semgrep.dev/r/go.lang.security.audit.md5-used-as-password.md5-used-as-password
17765
- shortlink: https://sg.run/4eOE
18142
+ source: https://semgrep.dev/r/ruby.lang.security.md5-used-as-password.md5-used-as-password
18143
+ shortlink: https://sg.run/GOZy
17766
18144
  semgrep.dev:
17767
18145
  rule:
17768
- r_id: 14688
17769
- rv_id: 1262938
17770
- rule_id: 4bU1Wj
17771
- version_id: nWT2L9r
17772
- url: https://semgrep.dev/playground/r/nWT2L9r/go.lang.security.audit.md5-used-as-password.md5-used-as-password
18146
+ r_id: 14704
18147
+ rv_id: 1263611
18148
+ rule_id: oqU4p2
18149
+ version_id: JdTzx0e
18150
+ url: https://semgrep.dev/playground/r/JdTzx0e/ruby.lang.security.md5-used-as-password.md5-used-as-password
17773
18151
  origin: community
17774
18152
  mode: taint
17775
18153
  pattern-sources:
17776
- - patterns:
17777
- - pattern-either:
17778
- - pattern: md5.New
17779
- - pattern: md5.Sum
18154
+ - pattern: Digest::MD5
17780
18155
  pattern-sinks:
17781
18156
  - patterns:
17782
- - pattern: $FUNCTION(...)
18157
+ - pattern: $FUNCTION(...);
17783
18158
  - metavariable-regex:
17784
18159
  metavariable: $FUNCTION
17785
18160
  regex: (?i)(.*password.*)
17786
- - id: go.lang.security.injection.tainted-sql-string.tainted-sql-string
18161
+ - id: ruby.rails.security.injection.tainted-url-host.tainted-url-host
17787
18162
  languages:
17788
- - go
17789
- message: User data flows into this manually-constructed SQL string. User data can
17790
- be safely inserted into SQL strings using prepared statements or an object-relational
17791
- mapper (ORM). Manually-constructed SQL strings is a possible indicator of SQL
17792
- injection, which could let an attacker steal or manipulate data from the database.
17793
- Instead, use prepared statements (`db.Query("SELECT * FROM t WHERE id = ?", id)`)
17794
- or a safe library.
17795
- options:
17796
- interfile: true
18163
+ - ruby
18164
+ severity: WARNING
18165
+ message: User data flows into the host portion of this manually-constructed URL.
18166
+ This could allow an attacker to send data to their own server, potentially exposing
18167
+ sensitive data such as cookies or authorization information sent with this request.
18168
+ They could also probe internal servers or other resources that the server running
18169
+ this code can access. (This is called server-side request forgery, or SSRF.) Do
18170
+ not allow arbitrary hosts. Use the `ssrf_filter` gem and guard the url construction
18171
+ with `SsrfFilter(...)`, or create an allowlist for approved hosts.
17797
18172
  metadata:
17798
18173
  cwe:
17799
- - 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command
17800
- (''SQL Injection'')'
18174
+ - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
18175
+ Scripting'')'
17801
18176
  owasp:
17802
- - A01:2017 - Injection
18177
+ - A07:2017 - Cross-Site Scripting (XSS)
17803
18178
  - A03:2021 - Injection
17804
18179
  - A05:2025 - Injection
17805
- references:
17806
- - https://golang.org/doc/database/sql-injection
17807
- - https://www.stackhawk.com/blog/golang-sql-injection-guide-examples-and-prevention/
17808
18180
  category: security
17809
18181
  technology:
17810
- - go
17811
- confidence: HIGH
18182
+ - rails
18183
+ references:
18184
+ - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
18185
+ - https://github.com/arkadiyt/ssrf_filter
17812
18186
  cwe2022-top25: true
17813
18187
  cwe2021-top25: true
17814
18188
  subcategory:
17815
18189
  - vuln
17816
- likelihood: HIGH
17817
- impact: MEDIUM
17818
- interfile: true
18190
+ likelihood: MEDIUM
18191
+ impact: HIGH
18192
+ confidence: MEDIUM
17819
18193
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17820
18194
  vulnerability_class:
17821
- - SQL Injection
17822
- source: https://semgrep.dev/r/go.lang.security.injection.tainted-sql-string.tainted-sql-string
17823
- shortlink: https://sg.run/PbEq
18195
+ - Cross-Site-Scripting (XSS)
18196
+ source: https://semgrep.dev/r/ruby.rails.security.injection.tainted-url-host.tainted-url-host
18197
+ shortlink: https://sg.run/RX3g
17824
18198
  semgrep.dev:
17825
18199
  rule:
17826
- r_id: 14689
17827
- rv_id: 1409388
17828
- rule_id: PeUoqy
17829
- version_id: nWTQ5qD
17830
- url: https://semgrep.dev/playground/r/nWTQ5qD/go.lang.security.injection.tainted-sql-string.tainted-sql-string
18200
+ r_id: 14705
18201
+ rv_id: 1263668
18202
+ rule_id: zdUY0W
18203
+ version_id: 6xT29BN
18204
+ url: https://semgrep.dev/playground/r/6xT29BN/ruby.rails.security.injection.tainted-url-host.tainted-url-host
17831
18205
  origin: community
17832
18206
  mode: taint
17833
- severity: ERROR
18207
+ pattern-sanitizers:
18208
+ - pattern: SsrfFilter
17834
18209
  pattern-sources:
17835
18210
  - patterns:
17836
18211
  - pattern-either:
17837
- - pattern: |
17838
- ($REQUEST : *http.Request).$ANYTHING
17839
- - pattern: |
17840
- ($REQUEST : http.Request).$ANYTHING
17841
- - metavariable-regex:
17842
- metavariable: $ANYTHING
17843
- regex: ^(BasicAuth|Body|Cookie|Cookies|Form|FormValue|GetBody|Host|MultipartReader|ParseForm|ParseMultipartForm|PostForm|PostFormValue|Referer|RequestURI|Trailer|TransferEncoding|UserAgent|URL)$
18212
+ - pattern: params
18213
+ - pattern: request
17844
18214
  pattern-sinks:
17845
18215
  - patterns:
17846
18216
  - pattern-either:
17847
18217
  - patterns:
17848
- - pattern-either:
17849
- - pattern: |
17850
- "$SQLSTR" + ...
17851
- - patterns:
17852
- - pattern-inside: |
17853
- $VAR = "$SQLSTR";
17854
- ...
17855
- - pattern: $VAR += ...
17856
- - patterns:
17857
- - pattern-inside: |
17858
- var $SB strings.Builder
17859
- ...
17860
- - pattern-inside: |
17861
- $SB.WriteString("$SQLSTR")
17862
- ...
17863
- $SB.String(...)
17864
- - pattern: |
17865
- $SB.WriteString(...)
17866
- - metavariable-regex:
17867
- metavariable: $SQLSTR
17868
- regex: (?i)(select|delete|insert|create|update|alter|drop).*
18218
+ - pattern: |
18219
+ $URLSTR
18220
+ - pattern-regex: \w+:\/\/#{.*}
17869
18221
  - patterns:
17870
18222
  - pattern-either:
17871
- - pattern: fmt.Fprintf($F, "$SQLSTR", ...)
17872
- - pattern: fmt.Sprintf("$SQLSTR", ...)
17873
- - pattern: fmt.Printf("$SQLSTR", ...)
17874
- - metavariable-regex:
17875
- metavariable: $SQLSTR
17876
- regex: \s*(?i)(select|delete|insert|create|update|alter|drop)\b.*%(v|s|q).*
17877
- pattern-sanitizers:
17878
- - pattern-either:
17879
- - pattern: strconv.Atoi(...)
17880
- - pattern: |
17881
- ($X: bool)
17882
- - id: java.lang.security.audit.md5-used-as-password.md5-used-as-password
18223
+ - pattern: Kernel::sprintf("$URLSTR", ...)
18224
+ - pattern: |
18225
+ "$URLSTR" + $EXPR
18226
+ - pattern: |
18227
+ "$URLSTR" % $EXPR
18228
+ - metavariable-pattern:
18229
+ metavariable: $URLSTR
18230
+ language: generic
18231
+ pattern: $SCHEME:// ...
18232
+ - id: ruby.rails.security.injection.tainted-sql-string.tainted-sql-string
17883
18233
  languages:
17884
- - java
17885
- severity: WARNING
17886
- message: It looks like MD5 is used as a password hash. MD5 is not considered a secure
17887
- password hash because it can be cracked by an attacker in a short amount of time.
17888
- Use a suitable password hashing function such as PBKDF2 or bcrypt. You can use
17889
- `javax.crypto.SecretKeyFactory` with `SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1")`
17890
- or, if using Spring, `org.springframework.security.crypto.bcrypt`.
18234
+ - ruby
18235
+ severity: ERROR
18236
+ message: Detected user input used to manually construct a SQL string. This is usually
18237
+ bad practice because manual construction could accidentally result in a SQL injection.
18238
+ An attacker could use a SQL injection to steal or modify contents of the database.
18239
+ Instead, use a parameterized query which is available by default in most database
18240
+ engines. Alternatively, consider using an object-relational mapper (ORM) such
18241
+ as ActiveRecord which will protect your queries.
17891
18242
  metadata:
18243
+ cwe:
18244
+ - 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command
18245
+ (''SQL Injection'')'
18246
+ owasp:
18247
+ - A01:2017 - Injection
18248
+ - A03:2021 - Injection
18249
+ - A05:2025 - Injection
17892
18250
  category: security
17893
18251
  technology:
17894
- - java
17895
- - md5
18252
+ - rails
17896
18253
  references:
17897
- - https://tools.ietf.org/id/draft-lvelvindron-tls-md5-sha1-deprecate-01.html
17898
- - https://github.com/returntocorp/semgrep-rules/issues/1609
17899
- - https://docs.oracle.com/javase/7/docs/technotes/guides/security/StandardNames.html#SecretKeyFactory
17900
- - https://docs.spring.io/spring-security/site/docs/current/api/org/springframework/security/crypto/bcrypt/BCryptPasswordEncoder.html
17901
- owasp:
17902
- - A03:2017 - Sensitive Data Exposure
17903
- - A02:2021 - Cryptographic Failures
17904
- - A04:2025 - Cryptographic Failures
17905
- cwe:
17906
- - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
18254
+ - https://rorsecurity.info/portfolio/ruby-on-rails-sql-injection-cheat-sheet
18255
+ cwe2022-top25: true
18256
+ cwe2021-top25: true
17907
18257
  subcategory:
17908
18258
  - vuln
17909
- likelihood: HIGH
17910
- impact: MEDIUM
18259
+ likelihood: MEDIUM
18260
+ impact: HIGH
17911
18261
  confidence: MEDIUM
17912
18262
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17913
18263
  vulnerability_class:
17914
- - Cryptographic Issues
17915
- source: https://semgrep.dev/r/java.lang.security.audit.md5-used-as-password.md5-used-as-password
17916
- shortlink: https://sg.run/JxEQ
18264
+ - SQL Injection
18265
+ source: https://semgrep.dev/r/ruby.rails.security.injection.tainted-sql-string.tainted-sql-string
18266
+ shortlink: https://sg.run/Y85o
17917
18267
  semgrep.dev:
17918
18268
  rule:
17919
- r_id: 14690
17920
- rv_id: 1263029
17921
- rule_id: JDULAW
17922
- version_id: bZT53QB
17923
- url: https://semgrep.dev/playground/r/bZT53QB/java.lang.security.audit.md5-used-as-password.md5-used-as-password
18269
+ r_id: 14714
18270
+ rv_id: 1263667
18271
+ rule_id: bwU8gl
18272
+ version_id: YDTZeLL
18273
+ url: https://semgrep.dev/playground/r/YDTZeLL/ruby.rails.security.injection.tainted-sql-string.tainted-sql-string
17924
18274
  origin: community
17925
18275
  mode: taint
17926
18276
  pattern-sources:
17927
18277
  - patterns:
17928
- - pattern-inside: |
17929
- $TYPE $MD = MessageDigest.getInstance("MD5");
17930
- ...
17931
- - pattern: $MD.digest(...);
18278
+ - pattern-either:
18279
+ - pattern: params
18280
+ - pattern: request
18281
+ pattern-sanitizers:
18282
+ - pattern: |
18283
+ $PARAMS.slice(...)
17932
18284
  pattern-sinks:
17933
18285
  - patterns:
17934
- - pattern: $MODEL.$METHOD(...);
17935
- - metavariable-regex:
17936
- metavariable: $METHOD
17937
- regex: (?i)(.*password.*)
17938
- - id: javascript.express.security.injection.raw-html-format.raw-html-format
17939
- message: User data flows into the host portion of this manually-constructed HTML.
17940
- This can introduce a Cross-Site-Scripting (XSS) vulnerability if this comes from
17941
- user-provided input. Consider using a sanitization library such as DOMPurify to
17942
- sanitize the HTML within.
18286
+ - pattern-either:
18287
+ - patterns:
18288
+ - pattern-either:
18289
+ - patterns:
18290
+ - pattern: |
18291
+ $RECORD.where($X,...)
18292
+ - pattern: |
18293
+ $RECORD.find(..., :conditions => $X,...)
18294
+ - focus-metavariable: $X
18295
+ - patterns:
18296
+ - pattern: |
18297
+ "$SQLVERB#{$EXPR}..."
18298
+ - pattern-not-inside: |
18299
+ $FUNC("...", "...#{$EXPR}...",...)
18300
+ - focus-metavariable: $SQLVERB
18301
+ - pattern-regex: (?i)(select|delete|insert|create|update|alter|drop)\b
18302
+ - patterns:
18303
+ - pattern-either:
18304
+ - pattern: Kernel::sprintf("$SQLSTR", $EXPR)
18305
+ - pattern: |
18306
+ "$SQLSTR" + $EXPR
18307
+ - pattern: |
18308
+ "$SQLSTR" % $EXPR
18309
+ - pattern-not-inside: |
18310
+ $FUNC("...", "...#{$EXPR}...",...)
18311
+ - focus-metavariable: $EXPR
18312
+ - metavariable-regex:
18313
+ metavariable: $SQLSTR
18314
+ regex: (?i)(select|delete|insert|create|update|alter|drop)\b
18315
+ - id: php.lang.security.injection.tainted-sql-string.tainted-sql-string
18316
+ languages:
18317
+ - php
18318
+ severity: ERROR
18319
+ message: User data flows into this manually-constructed SQL string. User data can
18320
+ be safely inserted into SQL strings using prepared statements or an object-relational
18321
+ mapper (ORM). Manually-constructed SQL strings is a possible indicator of SQL
18322
+ injection, which could let an attacker steal or manipulate data from the database.
18323
+ Instead, use prepared statements (`$mysqli->prepare("INSERT INTO test(id, label)
18324
+ VALUES (?, ?)");`) or a safe library.
17943
18325
  metadata:
17944
18326
  cwe:
17945
- - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
17946
- Scripting'')'
18327
+ - 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command
18328
+ (''SQL Injection'')'
17947
18329
  owasp:
17948
- - A07:2017 - Cross-Site Scripting (XSS)
18330
+ - A01:2017 - Injection
17949
18331
  - A03:2021 - Injection
17950
18332
  - A05:2025 - Injection
17951
18333
  references:
17952
- - https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html
18334
+ - https://owasp.org/www-community/attacks/SQL_Injection
17953
18335
  category: security
17954
18336
  technology:
17955
- - express
18337
+ - php
17956
18338
  cwe2022-top25: true
17957
18339
  cwe2021-top25: true
17958
18340
  subcategory:
@@ -17962,597 +18344,16 @@ rules:
17962
18344
  confidence: MEDIUM
17963
18345
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
17964
18346
  vulnerability_class:
17965
- - Cross-Site-Scripting (XSS)
17966
- source: https://semgrep.dev/r/javascript.express.security.injection.raw-html-format.raw-html-format
17967
- shortlink: https://sg.run/5DO3
18347
+ - SQL Injection
18348
+ source: https://semgrep.dev/r/php.lang.security.injection.tainted-sql-string.tainted-sql-string
18349
+ shortlink: https://sg.run/lZYG
17968
18350
  semgrep.dev:
17969
18351
  rule:
17970
- r_id: 14691
17971
- rv_id: 1263175
17972
- rule_id: 5rUL0X
17973
- version_id: NdTzyQv
17974
- url: https://semgrep.dev/playground/r/NdTzyQv/javascript.express.security.injection.raw-html-format.raw-html-format
17975
- origin: community
17976
- languages:
17977
- - javascript
17978
- - typescript
17979
- severity: WARNING
17980
- mode: taint
17981
- pattern-sources:
17982
- - label: EXPRESS
17983
- patterns:
17984
- - pattern-either:
17985
- - pattern-inside: function ... ($REQ, $RES) {...}
17986
- - pattern-inside: function ... ($REQ, $RES, $NEXT) {...}
17987
- - patterns:
17988
- - pattern-either:
17989
- - pattern-inside: $APP.$METHOD(..., function $FUNC($REQ, $RES) {...})
17990
- - pattern-inside: $APP.$METHOD(..., function $FUNC($REQ, $RES, $NEXT) {...})
17991
- - metavariable-regex:
17992
- metavariable: $METHOD
17993
- regex: ^(get|post|put|head|delete|options)$
17994
- - pattern-either:
17995
- - pattern: $REQ.query
17996
- - pattern: $REQ.body
17997
- - pattern: $REQ.params
17998
- - pattern: $REQ.cookies
17999
- - pattern: $REQ.headers
18000
- - label: EXPRESSTS
18001
- patterns:
18002
- - pattern-either:
18003
- - pattern-inside: |
18004
- ({ $REQ }: Request,$RES: Response, $NEXT: NextFunction) =>
18005
- {...}
18006
- - pattern-inside: |
18007
- ({ $REQ }: Request,$RES: Response) => {...}
18008
- - focus-metavariable: $REQ
18009
- - pattern-either:
18010
- - pattern: params
18011
- - pattern: query
18012
- - pattern: cookies
18013
- - pattern: headers
18014
- - pattern: body
18015
- - label: CLEAN
18016
- by-side-effect: true
18017
- patterns:
18018
- - pattern-either:
18019
- - pattern: $A($SOURCE)
18020
- - pattern: $SANITIZE. ... .$A($SOURCE)
18021
- - pattern: $A. ... .$SANITIZE($SOURCE)
18022
- - focus-metavariable: $SOURCE
18023
- - metavariable-regex:
18024
- metavariable: $A
18025
- regex: (?i)(.*valid|.*sanitiz)
18026
- pattern-sinks:
18027
- - requires: (EXPRESS and not CLEAN) or (EXPRESSTS and not CLEAN)
18028
- patterns:
18029
- - pattern-either:
18030
- - patterns:
18031
- - pattern-either:
18032
- - pattern: '"$HTMLSTR" + $EXPR'
18033
- - pattern: '"$HTMLSTR".concat(...)'
18034
- - pattern: util.format($HTMLSTR, ...)
18035
- - metavariable-pattern:
18036
- metavariable: $HTMLSTR
18037
- language: generic
18038
- pattern: <$TAG ...
18039
- - patterns:
18040
- - pattern: |
18041
- `...`
18042
- - pattern-regex: |
18043
- .*<\w+.*
18044
- - id: kotlin.lang.security.ecb-cipher.ecb-cipher
18045
- metadata:
18046
- cwe:
18047
- - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
18048
- owasp:
18049
- - A03:2017 - Sensitive Data Exposure
18050
- - A02:2021 - Cryptographic Failures
18051
- - A04:2025 - Cryptographic Failures
18052
- source-rule-url: https://find-sec-bugs.github.io/bugs.htm#ECB_MODE
18053
- category: security
18054
- technology:
18055
- - kotlin
18056
- references:
18057
- - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
18058
- subcategory:
18059
- - vuln
18060
- likelihood: LOW
18061
- impact: MEDIUM
18062
- confidence: MEDIUM
18063
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18064
- vulnerability_class:
18065
- - Cryptographic Issues
18066
- source: https://semgrep.dev/r/kotlin.lang.security.ecb-cipher.ecb-cipher
18067
- shortlink: https://sg.run/DzLj
18068
- semgrep.dev:
18069
- rule:
18070
- r_id: 14696
18071
- rv_id: 1263263
18072
- rule_id: DbU1Zd
18073
- version_id: YDTZexg
18074
- url: https://semgrep.dev/playground/r/YDTZexg/kotlin.lang.security.ecb-cipher.ecb-cipher
18075
- origin: community
18076
- message: Cipher in ECB mode is detected. ECB mode produces the same output for the
18077
- same input each time which allows an attacker to intercept and replay the data.
18078
- Further, ECB mode does not provide any integrity checking. See https://find-sec-bugs.github.io/bugs.htm#CIPHER_INTEGRITY.
18079
- severity: WARNING
18080
- languages:
18081
- - kt
18082
- patterns:
18083
- - pattern-either:
18084
- - pattern: |
18085
- val $VAR : Cipher = $CIPHER.getInstance($MODE)
18086
- - pattern: |
18087
- var $VAR : Cipher = $CIPHER.getInstance($MODE)
18088
- - pattern: |
18089
- val $VAR = $CIPHER.getInstance($MODE)
18090
- - pattern: |
18091
- var $VAR = $CIPHER.getInstance($MODE)
18092
- - metavariable-regex:
18093
- metavariable: $MODE
18094
- regex: .*ECB.*
18095
- - id: kotlin.lang.security.no-null-cipher.no-null-cipher
18096
- pattern: NullCipher(...)
18097
- metadata:
18098
- cwe:
18099
- - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
18100
- owasp:
18101
- - A03:2017 - Sensitive Data Exposure
18102
- - A02:2021 - Cryptographic Failures
18103
- - A04:2025 - Cryptographic Failures
18104
- source-rule-url: https://find-sec-bugs.github.io/bugs.htm#NULL_CIPHER
18105
- asvs:
18106
- section: V6 Stored Cryptography Verification Requirements
18107
- control_id: 6.2.5 Insecure Algorithm
18108
- control_url: https://github.com/OWASP/ASVS/blob/master/4.0/en/0x14-V6-Cryptography.md#v62-algorithms
18109
- version: '4'
18110
- category: security
18111
- technology:
18112
- - kotlin
18113
- references:
18114
- - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
18115
- subcategory:
18116
- - vuln
18117
- likelihood: LOW
18118
- impact: MEDIUM
18119
- confidence: MEDIUM
18120
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18121
- vulnerability_class:
18122
- - Cryptographic Issues
18123
- source: https://semgrep.dev/r/kotlin.lang.security.no-null-cipher.no-null-cipher
18124
- shortlink: https://sg.run/0ywb
18125
- semgrep.dev:
18126
- rule:
18127
- r_id: 14698
18128
- rv_id: 1263265
18129
- rule_id: 0oU2Yy
18130
- version_id: o5TbDPj
18131
- url: https://semgrep.dev/playground/r/o5TbDPj/kotlin.lang.security.no-null-cipher.no-null-cipher
18132
- origin: community
18133
- message: 'NullCipher was detected. This will not encrypt anything; the cipher text
18134
- will be the same as the plain text. Use a valid, secure cipher: Cipher.getInstance("AES/CBC/PKCS7PADDING").
18135
- See https://owasp.org/www-community/Using_the_Java_Cryptographic_Extensions for
18136
- more information.'
18137
- severity: WARNING
18138
- languages:
18139
- - kt
18140
- - scala
18141
- - id: kotlin.lang.security.use-of-md5.use-of-md5
18142
- message: Detected MD5 hash algorithm which is considered insecure. MD5 is not collision
18143
- resistant and is therefore not suitable as a cryptographic signature. Use SHA256
18144
- or SHA3 instead.
18145
- languages:
18146
- - kt
18147
- severity: WARNING
18148
- metadata:
18149
- owasp:
18150
- - A03:2017 - Sensitive Data Exposure
18151
- - A02:2021 - Cryptographic Failures
18152
- - A04:2025 - Cryptographic Failures
18153
- cwe:
18154
- - 'CWE-328: Use of Weak Hash'
18155
- source-rule-url: https://find-sec-bugs.github.io/bugs.htm#WEAK_MESSAGE_DIGEST_MD5
18156
- category: security
18157
- technology:
18158
- - kotlin
18159
- references:
18160
- - https://owasp.org/Top10/A02_2021-Cryptographic_Failures
18161
- subcategory:
18162
- - vuln
18163
- likelihood: LOW
18164
- impact: MEDIUM
18165
- confidence: MEDIUM
18166
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18167
- vulnerability_class:
18168
- - Insecure Hashing Algorithm
18169
- source: https://semgrep.dev/r/kotlin.lang.security.use-of-md5.use-of-md5
18170
- shortlink: https://sg.run/4eQx
18171
- semgrep.dev:
18172
- rule:
18173
- r_id: 14700
18174
- rv_id: 1263267
18175
- rule_id: qNUXPj
18176
- version_id: pZT03Jd
18177
- url: https://semgrep.dev/playground/r/pZT03Jd/kotlin.lang.security.use-of-md5.use-of-md5
18178
- origin: community
18179
- pattern-either:
18180
- - pattern: |
18181
- java.security.MessageDigest.getInstance("MD5")
18182
- - pattern: |
18183
- org.apache.commons.codec.digest.DigestUtils.getMd5Digest()
18184
- - id: python.flask.security.injection.tainted-sql-string.tainted-sql-string
18185
- message: Detected user input used to manually construct a SQL string. This is usually
18186
- bad practice because manual construction could accidentally result in a SQL injection.
18187
- An attacker could use a SQL injection to steal or modify contents of the database.
18188
- Instead, use a parameterized query which is available by default in most database
18189
- engines. Alternatively, consider using an object-relational mapper (ORM) such
18190
- as SQLAlchemy which will protect your queries.
18191
- metadata:
18192
- cwe:
18193
- - 'CWE-704: Incorrect Type Conversion or Cast'
18194
- owasp:
18195
- - A01:2017 - Injection
18196
- - A03:2021 - Injection
18197
- - A05:2025 - Injection
18198
- references:
18199
- - https://docs.sqlalchemy.org/en/14/core/tutorial.html#using-textual-sql
18200
- - https://www.tutorialspoint.com/sqlalchemy/sqlalchemy_quick_guide.htm
18201
- - https://docs.sqlalchemy.org/en/14/core/tutorial.html#using-more-specific-text-with-table-expression-literal-column-and-expression-column
18202
- category: security
18203
- technology:
18204
- - sqlalchemy
18205
- - flask
18206
- subcategory:
18207
- - vuln
18208
- impact: MEDIUM
18209
- likelihood: MEDIUM
18210
- confidence: MEDIUM
18211
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18212
- vulnerability_class:
18213
- - Improper Validation
18214
- source: https://semgrep.dev/r/python.flask.security.injection.tainted-sql-string.tainted-sql-string
18215
- shortlink: https://sg.run/JxZj
18216
- semgrep.dev:
18217
- rule:
18218
- r_id: 14702
18219
- rv_id: 1409402
18220
- rule_id: YGUDKQ
18221
- version_id: A8TEvb4
18222
- url: https://semgrep.dev/playground/r/A8TEvb4/python.flask.security.injection.tainted-sql-string.tainted-sql-string
18223
- origin: community
18224
- severity: ERROR
18225
- languages:
18226
- - python
18227
- mode: taint
18228
- pattern-sources:
18229
- - patterns:
18230
- - pattern-either:
18231
- - pattern: flask.request.$ANYTHING
18232
- - patterns:
18233
- - pattern-inside: |
18234
- @$APP.route(...)
18235
- def $FUNC(..., $ROUTEVAR, ...):
18236
- ...
18237
- - pattern: $ROUTEVAR
18238
- pattern-sinks:
18239
- - patterns:
18240
- - pattern-either:
18241
- - pattern: |
18242
- "$SQLSTR" + ...
18243
- - pattern: |
18244
- "$SQLSTR" % ...
18245
- - pattern: |
18246
- "$SQLSTR".format(...)
18247
- - pattern: |
18248
- f"$SQLSTR{...}..."
18249
- - metavariable-regex:
18250
- metavariable: $SQLSTR
18251
- regex: \s*(?i)(select|delete|insert|create|update|alter|drop)\b.*
18252
- - id: python.lang.security.audit.md5-used-as-password.md5-used-as-password
18253
- severity: WARNING
18254
- message: It looks like MD5 is used as a password hash. MD5 is not considered a secure
18255
- password hash because it can be cracked by an attacker in a short amount of time.
18256
- Use a suitable password hashing function such as scrypt. You can use `hashlib.scrypt`.
18257
- languages:
18258
- - python
18259
- metadata:
18260
- cwe:
18261
- - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
18262
- owasp:
18263
- - A03:2017 - Sensitive Data Exposure
18264
- - A02:2021 - Cryptographic Failures
18265
- - A04:2025 - Cryptographic Failures
18266
- references:
18267
- - https://tools.ietf.org/html/rfc6151
18268
- - https://crypto.stackexchange.com/questions/44151/how-does-the-flame-malware-take-advantage-of-md5-collision
18269
- - https://pycryptodome.readthedocs.io/en/latest/src/hash/sha3_256.html
18270
- - https://security.stackexchange.com/questions/211/how-to-securely-hash-passwords
18271
- - https://github.com/returntocorp/semgrep-rules/issues/1609
18272
- - https://docs.python.org/3/library/hashlib.html#hashlib.scrypt
18273
- category: security
18274
- technology:
18275
- - pycryptodome
18276
- - hashlib
18277
- - md5
18278
- subcategory:
18279
- - vuln
18280
- likelihood: HIGH
18281
- impact: LOW
18282
- confidence: MEDIUM
18283
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18284
- vulnerability_class:
18285
- - Cryptographic Issues
18286
- source: https://semgrep.dev/r/python.lang.security.audit.md5-used-as-password.md5-used-as-password
18287
- shortlink: https://sg.run/5DwD
18288
- semgrep.dev:
18289
- rule:
18290
- r_id: 14703
18291
- rv_id: 1263504
18292
- rule_id: 6JU1w1
18293
- version_id: WrTqKDz
18294
- url: https://semgrep.dev/playground/r/WrTqKDz/python.lang.security.audit.md5-used-as-password.md5-used-as-password
18295
- origin: community
18296
- mode: taint
18297
- pattern-sources:
18298
- - patterns:
18299
- - pattern-either:
18300
- - pattern: hashlib.md5
18301
- - pattern: hashlib.new(..., name="MD5", ...)
18302
- - pattern: Cryptodome.Hash.MD5
18303
- - pattern: Crypto.Hash.MD5
18304
- - pattern: cryptography.hazmat.primitives.hashes.MD5
18305
- pattern-sinks:
18306
- - patterns:
18307
- - pattern: $FUNCTION(...)
18308
- - metavariable-regex:
18309
- metavariable: $FUNCTION
18310
- regex: (?i)(.*password.*)
18311
- - id: ruby.lang.security.md5-used-as-password.md5-used-as-password
18312
- languages:
18313
- - ruby
18314
- severity: WARNING
18315
- message: It looks like MD5 is used as a password hash. MD5 is not considered a secure
18316
- password hash because it can be cracked by an attacker in a short amount of time.
18317
- Instead, use a suitable password hashing function such as bcrypt. You can use
18318
- the `bcrypt` gem.
18319
- metadata:
18320
- category: security
18321
- technology:
18322
- - md5
18323
- references:
18324
- - https://tools.ietf.org/id/draft-lvelvindron-tls-md5-sha1-deprecate-01.html
18325
- - https://security.stackexchange.com/questions/211/how-to-securely-hash-passwords
18326
- - https://github.com/returntocorp/semgrep-rules/issues/1609
18327
- owasp:
18328
- - A03:2017 - Sensitive Data Exposure
18329
- - A02:2021 - Cryptographic Failures
18330
- - A04:2025 - Cryptographic Failures
18331
- cwe:
18332
- - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
18333
- subcategory:
18334
- - vuln
18335
- likelihood: HIGH
18336
- impact: MEDIUM
18337
- confidence: MEDIUM
18338
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18339
- vulnerability_class:
18340
- - Cryptographic Issues
18341
- source: https://semgrep.dev/r/ruby.lang.security.md5-used-as-password.md5-used-as-password
18342
- shortlink: https://sg.run/GOZy
18343
- semgrep.dev:
18344
- rule:
18345
- r_id: 14704
18346
- rv_id: 1263611
18347
- rule_id: oqU4p2
18348
- version_id: JdTzx0e
18349
- url: https://semgrep.dev/playground/r/JdTzx0e/ruby.lang.security.md5-used-as-password.md5-used-as-password
18350
- origin: community
18351
- mode: taint
18352
- pattern-sources:
18353
- - pattern: Digest::MD5
18354
- pattern-sinks:
18355
- - patterns:
18356
- - pattern: $FUNCTION(...);
18357
- - metavariable-regex:
18358
- metavariable: $FUNCTION
18359
- regex: (?i)(.*password.*)
18360
- - id: ruby.rails.security.injection.tainted-url-host.tainted-url-host
18361
- languages:
18362
- - ruby
18363
- severity: WARNING
18364
- message: User data flows into the host portion of this manually-constructed URL.
18365
- This could allow an attacker to send data to their own server, potentially exposing
18366
- sensitive data such as cookies or authorization information sent with this request.
18367
- They could also probe internal servers or other resources that the server running
18368
- this code can access. (This is called server-side request forgery, or SSRF.) Do
18369
- not allow arbitrary hosts. Use the `ssrf_filter` gem and guard the url construction
18370
- with `SsrfFilter(...)`, or create an allowlist for approved hosts.
18371
- metadata:
18372
- cwe:
18373
- - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
18374
- Scripting'')'
18375
- owasp:
18376
- - A07:2017 - Cross-Site Scripting (XSS)
18377
- - A03:2021 - Injection
18378
- - A05:2025 - Injection
18379
- category: security
18380
- technology:
18381
- - rails
18382
- references:
18383
- - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
18384
- - https://github.com/arkadiyt/ssrf_filter
18385
- cwe2022-top25: true
18386
- cwe2021-top25: true
18387
- subcategory:
18388
- - vuln
18389
- likelihood: MEDIUM
18390
- impact: HIGH
18391
- confidence: MEDIUM
18392
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18393
- vulnerability_class:
18394
- - Cross-Site-Scripting (XSS)
18395
- source: https://semgrep.dev/r/ruby.rails.security.injection.tainted-url-host.tainted-url-host
18396
- shortlink: https://sg.run/RX3g
18397
- semgrep.dev:
18398
- rule:
18399
- r_id: 14705
18400
- rv_id: 1263668
18401
- rule_id: zdUY0W
18402
- version_id: 6xT29BN
18403
- url: https://semgrep.dev/playground/r/6xT29BN/ruby.rails.security.injection.tainted-url-host.tainted-url-host
18404
- origin: community
18405
- mode: taint
18406
- pattern-sanitizers:
18407
- - pattern: SsrfFilter
18408
- pattern-sources:
18409
- - patterns:
18410
- - pattern-either:
18411
- - pattern: params
18412
- - pattern: request
18413
- pattern-sinks:
18414
- - patterns:
18415
- - pattern-either:
18416
- - patterns:
18417
- - pattern: |
18418
- $URLSTR
18419
- - pattern-regex: \w+:\/\/#{.*}
18420
- - patterns:
18421
- - pattern-either:
18422
- - pattern: Kernel::sprintf("$URLSTR", ...)
18423
- - pattern: |
18424
- "$URLSTR" + $EXPR
18425
- - pattern: |
18426
- "$URLSTR" % $EXPR
18427
- - metavariable-pattern:
18428
- metavariable: $URLSTR
18429
- language: generic
18430
- pattern: $SCHEME:// ...
18431
- - id: ruby.rails.security.injection.tainted-sql-string.tainted-sql-string
18432
- languages:
18433
- - ruby
18434
- severity: ERROR
18435
- message: Detected user input used to manually construct a SQL string. This is usually
18436
- bad practice because manual construction could accidentally result in a SQL injection.
18437
- An attacker could use a SQL injection to steal or modify contents of the database.
18438
- Instead, use a parameterized query which is available by default in most database
18439
- engines. Alternatively, consider using an object-relational mapper (ORM) such
18440
- as ActiveRecord which will protect your queries.
18441
- metadata:
18442
- cwe:
18443
- - 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command
18444
- (''SQL Injection'')'
18445
- owasp:
18446
- - A01:2017 - Injection
18447
- - A03:2021 - Injection
18448
- - A05:2025 - Injection
18449
- category: security
18450
- technology:
18451
- - rails
18452
- references:
18453
- - https://rorsecurity.info/portfolio/ruby-on-rails-sql-injection-cheat-sheet
18454
- cwe2022-top25: true
18455
- cwe2021-top25: true
18456
- subcategory:
18457
- - vuln
18458
- likelihood: MEDIUM
18459
- impact: HIGH
18460
- confidence: MEDIUM
18461
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18462
- vulnerability_class:
18463
- - SQL Injection
18464
- source: https://semgrep.dev/r/ruby.rails.security.injection.tainted-sql-string.tainted-sql-string
18465
- shortlink: https://sg.run/Y85o
18466
- semgrep.dev:
18467
- rule:
18468
- r_id: 14714
18469
- rv_id: 1263667
18470
- rule_id: bwU8gl
18471
- version_id: YDTZeLL
18472
- url: https://semgrep.dev/playground/r/YDTZeLL/ruby.rails.security.injection.tainted-sql-string.tainted-sql-string
18473
- origin: community
18474
- mode: taint
18475
- pattern-sources:
18476
- - patterns:
18477
- - pattern-either:
18478
- - pattern: params
18479
- - pattern: request
18480
- pattern-sanitizers:
18481
- - pattern: |
18482
- $PARAMS.slice(...)
18483
- pattern-sinks:
18484
- - patterns:
18485
- - pattern-either:
18486
- - patterns:
18487
- - pattern-either:
18488
- - patterns:
18489
- - pattern: |
18490
- $RECORD.where($X,...)
18491
- - pattern: |
18492
- $RECORD.find(..., :conditions => $X,...)
18493
- - focus-metavariable: $X
18494
- - patterns:
18495
- - pattern: |
18496
- "$SQLVERB#{$EXPR}..."
18497
- - pattern-not-inside: |
18498
- $FUNC("...", "...#{$EXPR}...",...)
18499
- - focus-metavariable: $SQLVERB
18500
- - pattern-regex: (?i)(select|delete|insert|create|update|alter|drop)\b
18501
- - patterns:
18502
- - pattern-either:
18503
- - pattern: Kernel::sprintf("$SQLSTR", $EXPR)
18504
- - pattern: |
18505
- "$SQLSTR" + $EXPR
18506
- - pattern: |
18507
- "$SQLSTR" % $EXPR
18508
- - pattern-not-inside: |
18509
- $FUNC("...", "...#{$EXPR}...",...)
18510
- - focus-metavariable: $EXPR
18511
- - metavariable-regex:
18512
- metavariable: $SQLSTR
18513
- regex: (?i)(select|delete|insert|create|update|alter|drop)\b
18514
- - id: php.lang.security.injection.tainted-sql-string.tainted-sql-string
18515
- languages:
18516
- - php
18517
- severity: ERROR
18518
- message: User data flows into this manually-constructed SQL string. User data can
18519
- be safely inserted into SQL strings using prepared statements or an object-relational
18520
- mapper (ORM). Manually-constructed SQL strings is a possible indicator of SQL
18521
- injection, which could let an attacker steal or manipulate data from the database.
18522
- Instead, use prepared statements (`$mysqli->prepare("INSERT INTO test(id, label)
18523
- VALUES (?, ?)");`) or a safe library.
18524
- metadata:
18525
- cwe:
18526
- - 'CWE-89: Improper Neutralization of Special Elements used in an SQL Command
18527
- (''SQL Injection'')'
18528
- owasp:
18529
- - A01:2017 - Injection
18530
- - A03:2021 - Injection
18531
- - A05:2025 - Injection
18532
- references:
18533
- - https://owasp.org/www-community/attacks/SQL_Injection
18534
- category: security
18535
- technology:
18536
- - php
18537
- cwe2022-top25: true
18538
- cwe2021-top25: true
18539
- subcategory:
18540
- - vuln
18541
- likelihood: HIGH
18542
- impact: MEDIUM
18543
- confidence: MEDIUM
18544
- license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
18545
- vulnerability_class:
18546
- - SQL Injection
18547
- source: https://semgrep.dev/r/php.lang.security.injection.tainted-sql-string.tainted-sql-string
18548
- shortlink: https://sg.run/lZYG
18549
- semgrep.dev:
18550
- rule:
18551
- r_id: 14757
18552
- rv_id: 1263290
18553
- rule_id: qNUXdL
18554
- version_id: gETB7vY
18555
- url: https://semgrep.dev/playground/r/gETB7vY/php.lang.security.injection.tainted-sql-string.tainted-sql-string
18352
+ r_id: 14757
18353
+ rv_id: 1263290
18354
+ rule_id: qNUXdL
18355
+ version_id: gETB7vY
18356
+ url: https://semgrep.dev/playground/r/gETB7vY/php.lang.security.injection.tainted-sql-string.tainted-sql-string
18556
18357
  origin: community
18557
18358
  mode: taint
18558
18359
  pattern-sanitizers:
@@ -41259,161 +41060,360 @@ rules:
41259
41060
  - https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-secrets
41260
41061
  - https://docs.github.com/en/actions/learn-github-actions/variables#defining-environment-variables-for-a-single-workflow
41261
41062
  technology:
41262
- - github-actions
41263
- subcategory:
41264
- - audit
41265
- likelihood: LOW
41266
- impact: HIGH
41063
+ - github-actions
41064
+ subcategory:
41065
+ - audit
41066
+ likelihood: LOW
41067
+ impact: HIGH
41068
+ confidence: MEDIUM
41069
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
41070
+ vulnerability_class:
41071
+ - Improper Authorization
41072
+ source: https://semgrep.dev/r/yaml.github-actions.security.gha-workflow-env-secret.gha-workflow-env-secret
41073
+ shortlink: https://sg.run/Rrn12
41074
+ semgrep.dev:
41075
+ rule:
41076
+ r_id: 309393
41077
+ rv_id: 1443457
41078
+ rule_id: OrUnq7z
41079
+ version_id: yeTqX9r
41080
+ url: https://semgrep.dev/playground/r/yeTqX9r/yaml.github-actions.security.gha-workflow-env-secret.gha-workflow-env-secret
41081
+ origin: community
41082
+ patterns:
41083
+ - pattern-inside: |
41084
+ env:
41085
+ ...
41086
+ - pattern-regex: \$\{\{\s*secrets\.
41087
+ - pattern-not-inside: 'jobs: ...'
41088
+ severity: WARNING
41089
+ - id: go.lang.security.injection.raw-html-format.raw-html-format
41090
+ languages:
41091
+ - go
41092
+ severity: WARNING
41093
+ message: Detected user input flowing into a manually constructed HTML string. You
41094
+ may be accidentally bypassing secure methods of rendering HTML by manually constructing
41095
+ HTML and this could create a cross-site scripting vulnerability, which could let
41096
+ attackers steal sensitive user data. Use the `html/template` package which will
41097
+ safely render HTML instead, or inspect that the HTML is rendered safely.
41098
+ metadata:
41099
+ cwe:
41100
+ - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
41101
+ Scripting'')'
41102
+ owasp:
41103
+ - A07:2017 - Cross-Site Scripting (XSS)
41104
+ - A03:2021 - Injection
41105
+ - A05:2025 - Injection
41106
+ category: security
41107
+ technology:
41108
+ - go
41109
+ references:
41110
+ - https://blogtitle.github.io/robn-go-security-pearls-cross-site-scripting-xss/
41111
+ confidence: MEDIUM
41112
+ cwe2022-top25: true
41113
+ cwe2021-top25: true
41114
+ subcategory:
41115
+ - vuln
41116
+ likelihood: HIGH
41117
+ impact: MEDIUM
41118
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
41119
+ vulnerability_class:
41120
+ - Cross-Site-Scripting (XSS)
41121
+ source: https://semgrep.dev/r/go.lang.security.injection.raw-html-format.raw-html-format
41122
+ shortlink: https://sg.run/3r1G
41123
+ semgrep.dev:
41124
+ rule:
41125
+ r_id: 14443
41126
+ rv_id: 1262968
41127
+ rule_id: PeUonQ
41128
+ version_id: 1QTyp2p
41129
+ url: https://semgrep.dev/playground/r/1QTyp2p/go.lang.security.injection.raw-html-format.raw-html-format
41130
+ origin: community
41131
+ mode: taint
41132
+ pattern-sources:
41133
+ - patterns:
41134
+ - pattern-either:
41135
+ - pattern: |
41136
+ ($REQUEST : *http.Request).$ANYTHING
41137
+ - pattern: |
41138
+ ($REQUEST : http.Request).$ANYTHING
41139
+ - metavariable-regex:
41140
+ metavariable: $ANYTHING
41141
+ regex: ^(BasicAuth|Body|Cookie|Cookies|Form|FormValue|GetBody|Host|MultipartReader|ParseForm|ParseMultipartForm|PostForm|PostFormValue|Referer|RequestURI|Trailer|TransferEncoding|UserAgent|URL)$
41142
+ pattern-sanitizers:
41143
+ - pattern: html.EscapeString(...)
41144
+ pattern-sinks:
41145
+ - patterns:
41146
+ - pattern-either:
41147
+ - pattern: fmt.Printf("$HTMLSTR", ...)
41148
+ - pattern: fmt.Sprintf("$HTMLSTR", ...)
41149
+ - pattern: fmt.Fprintf($W, "$HTMLSTR", ...)
41150
+ - pattern: '"$HTMLSTR" + ...'
41151
+ - metavariable-pattern:
41152
+ metavariable: $HTMLSTR
41153
+ language: generic
41154
+ pattern: <$TAG ...
41155
+ - id: ruby.rails.security.injection.raw-html-format.raw-html-format
41156
+ languages:
41157
+ - ruby
41158
+ severity: WARNING
41159
+ message: Detected user input flowing into a manually constructed HTML string. You
41160
+ may be accidentally bypassing secure methods of rendering HTML by manually constructing
41161
+ HTML and this could create a cross-site scripting vulnerability, which could let
41162
+ attackers steal sensitive user data. Use the `render template` and make template
41163
+ files which will safely render HTML instead, or inspect that the HTML is absolutely
41164
+ rendered safely with a function like `sanitize`.
41165
+ metadata:
41166
+ cwe:
41167
+ - 'CWE-79: Improper Neutralization of Input During Web Page Generation (''Cross-site
41168
+ Scripting'')'
41169
+ owasp:
41170
+ - A07:2017 - Cross-Site Scripting (XSS)
41171
+ - A03:2021 - Injection
41172
+ - A05:2025 - Injection
41173
+ category: security
41174
+ technology:
41175
+ - rails
41176
+ references:
41177
+ - https://www.netsparker.com/blog/web-security/preventing-xss-ruby-on-rails-web-applications/
41178
+ - https://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html
41179
+ cwe2022-top25: true
41180
+ cwe2021-top25: true
41181
+ subcategory:
41182
+ - vuln
41183
+ likelihood: HIGH
41184
+ impact: MEDIUM
41185
+ confidence: MEDIUM
41186
+ license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
41187
+ vulnerability_class:
41188
+ - Cross-Site-Scripting (XSS)
41189
+ source: https://semgrep.dev/r/ruby.rails.security.injection.raw-html-format.raw-html-format
41190
+ shortlink: https://sg.run/b2JQ
41191
+ semgrep.dev:
41192
+ rule:
41193
+ r_id: 14470
41194
+ rv_id: 1409408
41195
+ rule_id: kxUwZX
41196
+ version_id: qkTvgYY
41197
+ url: https://semgrep.dev/playground/r/qkTvgYY/ruby.rails.security.injection.raw-html-format.raw-html-format
41198
+ origin: community
41199
+ mode: taint
41200
+ pattern-sanitizers:
41201
+ - pattern-either:
41202
+ - pattern: sanitize(...)
41203
+ - pattern: strip_tags(...)
41204
+ pattern-sources:
41205
+ - patterns:
41206
+ - pattern-either:
41207
+ - pattern: params
41208
+ - pattern: request
41209
+ pattern-sinks:
41210
+ - patterns:
41211
+ - pattern-either:
41212
+ - patterns:
41213
+ - pattern: |
41214
+ $HTMLSTR
41215
+ - pattern-regex: <\w+.*
41216
+ - patterns:
41217
+ - pattern-either:
41218
+ - pattern: Kernel::sprintf("$HTMLSTR", ...)
41219
+ - pattern: |
41220
+ "$HTMLSTR" + $EXPR
41221
+ - pattern: |
41222
+ "$HTMLSTR" % $EXPR
41223
+ - metavariable-pattern:
41224
+ metavariable: $HTMLSTR
41225
+ language: generic
41226
+ pattern: <$TAG ...
41227
+ - id: bash.curl.security.curl-eval.curl-eval
41228
+ severity: WARNING
41229
+ languages:
41230
+ - bash
41231
+ message: Data is being eval'd from a `curl` command. An attacker with control of
41232
+ the server in the `curl` command could inject malicious code into the `eval`,
41233
+ resulting in a system comrpomise. Avoid eval'ing untrusted data if you can. If
41234
+ you must do this, consider checking the SHA sum of the content returned by the
41235
+ server to verify its integrity.
41236
+ metadata:
41237
+ owasp:
41238
+ - A03:2021 - Injection
41239
+ - A05:2025 - Injection
41240
+ cwe:
41241
+ - 'CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code
41242
+ (''Eval Injection'')'
41243
+ category: security
41244
+ technology:
41245
+ - bash
41246
+ - curl
41267
41247
  confidence: MEDIUM
41248
+ references:
41249
+ - https://owasp.org/Top10/A03_2021-Injection
41250
+ subcategory:
41251
+ - vuln
41252
+ likelihood: MEDIUM
41253
+ impact: MEDIUM
41268
41254
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
41269
41255
  vulnerability_class:
41270
- - Improper Authorization
41271
- source: https://semgrep.dev/r/yaml.github-actions.security.gha-workflow-env-secret.gha-workflow-env-secret
41272
- shortlink: https://sg.run/Rrn12
41256
+ - Code Injection
41257
+ source: https://semgrep.dev/r/bash.curl.security.curl-eval.curl-eval
41258
+ shortlink: https://sg.run/0yqJ
41273
41259
  semgrep.dev:
41274
41260
  rule:
41275
- r_id: 309393
41276
- rv_id: 1443457
41277
- rule_id: OrUnq7z
41278
- version_id: yeTqX9r
41279
- url: https://semgrep.dev/playground/r/yeTqX9r/yaml.github-actions.security.gha-workflow-env-secret.gha-workflow-env-secret
41261
+ r_id: 14554
41262
+ rv_id: 1262601
41263
+ rule_id: KxU7Rq
41264
+ version_id: JdTzxL2
41265
+ url: https://semgrep.dev/playground/r/JdTzxL2/bash.curl.security.curl-eval.curl-eval
41280
41266
  origin: community
41281
- patterns:
41282
- - pattern-inside: |
41283
- env:
41284
- ...
41285
- - pattern-regex: \$\{\{\s*secrets\.
41286
- - pattern-not-inside: 'jobs: ...'
41287
- severity: WARNING
41288
- - id: ruby.rails.security.audit.xss.avoid-render-dynamic-path.avoid-render-dynamic-path
41267
+ mode: taint
41268
+ pattern-sources:
41269
+ - pattern: |
41270
+ $(curl ...)
41271
+ - pattern: |
41272
+ `curl ...`
41273
+ pattern-sinks:
41274
+ - pattern: eval ...
41275
+ - id: python.flask.security.injection.tainted-url-host.tainted-url-host
41276
+ languages:
41277
+ - python
41278
+ message: User data flows into the host portion of this manually-constructed URL.
41279
+ This could allow an attacker to send data to their own server, potentially exposing
41280
+ sensitive data such as cookies or authorization information sent with this request.
41281
+ They could also probe internal servers or other resources that the server running
41282
+ this code can access. (This is called server-side request forgery, or SSRF.) Do
41283
+ not allow arbitrary hosts. Instead, create an allowlist for approved hosts, or
41284
+ hardcode the correct host.
41289
41285
  metadata:
41286
+ cwe:
41287
+ - 'CWE-918: Server-Side Request Forgery (SSRF)'
41290
41288
  owasp:
41291
- - A05:2017 - Broken Access Control
41292
- - A01:2021 - Broken Access Control
41289
+ - A10:2021 - Server-Side Request Forgery (SSRF)
41293
41290
  - A01:2025 - Broken Access Control
41294
- cwe:
41295
- - 'CWE-22: Improper Limitation of a Pathname to a Restricted Directory (''Path
41296
- Traversal'')'
41297
41291
  references:
41298
- - https://brakemanscanner.org/docs/warning_types/dynamic_render_paths/
41292
+ - https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
41299
41293
  category: security
41300
41294
  technology:
41301
- - rails
41295
+ - flask
41302
41296
  cwe2022-top25: true
41303
41297
  cwe2021-top25: true
41304
41298
  subcategory:
41305
41299
  - vuln
41306
- likelihood: HIGH
41307
41300
  impact: MEDIUM
41301
+ likelihood: MEDIUM
41308
41302
  confidence: MEDIUM
41309
41303
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
41310
41304
  vulnerability_class:
41311
- - Path Traversal
41312
- source: https://semgrep.dev/r/ruby.rails.security.audit.xss.avoid-render-dynamic-path.avoid-render-dynamic-path
41313
- shortlink: https://sg.run/GO2n
41305
+ - Server-Side Request Forgery (SSRF)
41306
+ source: https://semgrep.dev/r/python.flask.security.injection.tainted-url-host.tainted-url-host
41307
+ shortlink: https://sg.run/RXpK
41314
41308
  semgrep.dev:
41315
41309
  rule:
41316
- r_id: 13592
41317
- rv_id: 1263635
41318
- rule_id: 6JU1bL
41319
- version_id: bZT53p0
41320
- url: https://semgrep.dev/playground/r/bZT53p0/ruby.rails.security.audit.xss.avoid-render-dynamic-path.avoid-render-dynamic-path
41310
+ r_id: 14649
41311
+ rv_id: 1409403
41312
+ rule_id: ReU3Wb
41313
+ version_id: BjTy42w
41314
+ url: https://semgrep.dev/playground/r/BjTy42w/python.flask.security.injection.tainted-url-host.tainted-url-host
41321
41315
  origin: community
41322
- message: Avoid rendering user input. It may be possible for a malicious user to
41323
- input a path that lets them access a template they shouldn't. To prevent this,
41324
- check dynamic template paths against a predefined allowlist to make sure it's
41325
- an allowed template.
41326
- languages:
41327
- - ruby
41328
- severity: WARNING
41329
41316
  mode: taint
41330
- pattern-sources:
41331
- - pattern: params
41332
- - pattern: cookies
41333
- - pattern: request.env
41334
41317
  pattern-sinks:
41335
41318
  - patterns:
41336
- - pattern-inside: render($X => $INPUT, ...)
41337
- - pattern: $INPUT
41338
- - metavariable-pattern:
41339
- metavariable: $X
41340
- pattern-either:
41341
- - pattern: action
41342
- - pattern: template
41343
- - pattern: partial
41344
- - pattern: file
41345
- - id: python.lang.security.audit.insecure-file-permissions.insecure-file-permissions
41319
+ - pattern-either:
41320
+ - patterns:
41321
+ - pattern: '"$URLSTR" % ...'
41322
+ - metavariable-pattern:
41323
+ metavariable: $URLSTR
41324
+ language: generic
41325
+ patterns:
41326
+ - pattern-either:
41327
+ - pattern: $SCHEME://%s
41328
+ - pattern: $SCHEME://%r
41329
+ - patterns:
41330
+ - pattern: '"$URLSTR".format(...)'
41331
+ - metavariable-pattern:
41332
+ metavariable: $URLSTR
41333
+ language: generic
41334
+ pattern: $SCHEME:// { ... }
41335
+ - patterns:
41336
+ - pattern: '"$URLSTR" + ...'
41337
+ - metavariable-regex:
41338
+ metavariable: $URLSTR
41339
+ regex: .*://$
41340
+ - patterns:
41341
+ - pattern: f"$URLSTR{...}..."
41342
+ - metavariable-regex:
41343
+ metavariable: $URLSTR
41344
+ regex: .*://$
41345
+ - patterns:
41346
+ - pattern-inside: |
41347
+ $URL = "$URLSTR"
41348
+ ...
41349
+ - pattern: $URL += ...
41350
+ - metavariable-regex:
41351
+ metavariable: $URLSTR
41352
+ regex: .*://$
41353
+ pattern-sources:
41354
+ - patterns:
41355
+ - pattern-either:
41356
+ - pattern: flask.request.$ANYTHING
41357
+ - patterns:
41358
+ - pattern-inside: |
41359
+ @$APP.route(...)
41360
+ def $FUNC(..., $ROUTEVAR, ...):
41361
+ ...
41362
+ - pattern: $ROUTEVAR
41363
+ severity: WARNING
41364
+ - id: go.lang.security.audit.md5-used-as-password.md5-used-as-password
41346
41365
  languages:
41347
- - python
41366
+ - go
41348
41367
  severity: WARNING
41368
+ message: It looks like MD5 is used as a password hash. MD5 is not considered a secure
41369
+ password hash because it can be cracked by an attacker in a short amount of time.
41370
+ Use a suitable password hashing function such as bcrypt. You can use the `golang.org/x/crypto/bcrypt`
41371
+ package.
41372
+ options:
41373
+ interfile: true
41349
41374
  metadata:
41350
41375
  category: security
41351
- owasp:
41352
- - A01:2021 - Broken Access Control
41353
- - A01:2025 - Broken Access Control
41354
- cwe:
41355
- - 'CWE-276: Incorrect Default Permissions'
41356
41376
  technology:
41357
- - python
41377
+ - md5
41358
41378
  references:
41359
- - https://owasp.org/Top10/A01_2021-Broken_Access_Control
41360
- cwe2022-top25: true
41361
- cwe2021-top25: true
41379
+ - https://tools.ietf.org/id/draft-lvelvindron-tls-md5-sha1-deprecate-01.html
41380
+ - https://security.stackexchange.com/questions/211/how-to-securely-hash-passwords
41381
+ - https://github.com/returntocorp/semgrep-rules/issues/1609
41382
+ - https://pkg.go.dev/golang.org/x/crypto/bcrypt
41383
+ owasp:
41384
+ - A03:2017 - Sensitive Data Exposure
41385
+ - A02:2021 - Cryptographic Failures
41386
+ - A04:2025 - Cryptographic Failures
41387
+ cwe:
41388
+ - 'CWE-327: Use of a Broken or Risky Cryptographic Algorithm'
41389
+ confidence: MEDIUM
41362
41390
  subcategory:
41363
41391
  - vuln
41364
- likelihood: LOW
41392
+ likelihood: MEDIUM
41365
41393
  impact: MEDIUM
41366
- confidence: MEDIUM
41394
+ interfile: true
41367
41395
  license: Semgrep Rules License v1.0. For more details, visit semgrep.dev/legal/rules-license
41368
41396
  vulnerability_class:
41369
- - Improper Authorization
41370
- source: https://semgrep.dev/r/python.lang.security.audit.insecure-file-permissions.insecure-file-permissions
41371
- shortlink: https://sg.run/AXY4
41397
+ - Cryptographic Issues
41398
+ source: https://semgrep.dev/r/go.lang.security.audit.md5-used-as-password.md5-used-as-password
41399
+ shortlink: https://sg.run/4eOE
41372
41400
  semgrep.dev:
41373
41401
  rule:
41374
- r_id: 13594
41375
- rv_id: 1263482
41376
- rule_id: zdUYqR
41377
- version_id: O9Tpxqr
41378
- url: https://semgrep.dev/playground/r/O9Tpxqr/python.lang.security.audit.insecure-file-permissions.insecure-file-permissions
41402
+ r_id: 14688
41403
+ rv_id: 1262938
41404
+ rule_id: 4bU1Wj
41405
+ version_id: nWT2L9r
41406
+ url: https://semgrep.dev/playground/r/nWT2L9r/go.lang.security.audit.md5-used-as-password.md5-used-as-password
41379
41407
  origin: community
41380
- message: These permissions `$BITS` are widely permissive and grant access to more
41381
- people than may be necessary. A good default is `0o644` which gives read and write
41382
- access to yourself and read access to everyone else.
41383
- patterns:
41384
- - pattern-inside: os.$METHOD(...)
41385
- - metavariable-pattern:
41386
- metavariable: $METHOD
41387
- patterns:
41388
- - pattern-either:
41389
- - pattern: chmod
41390
- - pattern: lchmod
41391
- - pattern: fchmod
41392
- - pattern-either:
41393
- - patterns:
41394
- - pattern: os.$METHOD($FILE, $BITS, ...)
41395
- - metavariable-comparison:
41396
- metavariable: $BITS
41397
- comparison: $BITS >= 0o650 and $BITS < 0o100000
41398
- - patterns:
41399
- - pattern: os.$METHOD($FILE, $BITS)
41400
- - metavariable-comparison:
41401
- metavariable: $BITS
41402
- comparison: $BITS >= 0o100650
41403
- - patterns:
41404
- - pattern: os.$METHOD($FILE, $BITS, ...)
41405
- - metavariable-pattern:
41406
- metavariable: $BITS
41407
- patterns:
41408
- - pattern-either:
41409
- - pattern: <... stat.S_IWGRP ...>
41410
- - pattern: <... stat.S_IXGRP ...>
41411
- - pattern: <... stat.S_IWOTH ...>
41412
- - pattern: <... stat.S_IXOTH ...>
41413
- - pattern: <... stat.S_IRWXO ...>
41414
- - pattern: <... stat.S_IRWXG ...>
41415
- - patterns:
41416
- - pattern: os.$METHOD($FILE, $EXPR | $MOD, ...)
41417
- - metavariable-comparison:
41418
- metavariable: $MOD
41419
- comparison: $MOD == 0o111
41408
+ mode: taint
41409
+ pattern-sources:
41410
+ - patterns:
41411
+ - pattern-either:
41412
+ - pattern: md5.New
41413
+ - pattern: md5.Sum
41414
+ pattern-sinks:
41415
+ - patterns:
41416
+ - pattern: $FUNCTION(...)
41417
+ - metavariable-regex:
41418
+ metavariable: $FUNCTION
41419
+ regex: (?i)(.*password.*)