bump_vuln_gem 0.1.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.
- checksums.yaml +7 -0
- data/.idea/.gitignore +8 -0
- data/.idea/bump_vuln_gem.iml +34 -0
- data/.idea/misc.xml +4 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/CHANGELOG.md +5 -0
- data/README.md +35 -0
- data/Rakefile +8 -0
- data/lib/bump_vuln_gem/version.rb +5 -0
- data/lib/bump_vuln_gem.rb +93 -0
- data/sig/bump_vuln_gem.rbs +4 -0
- metadata +101 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5ab1f7cf65b54fed4a9371fd197e37f2b585cd16a72119c1d98d201d6930d486
|
|
4
|
+
data.tar.gz: cffe43c4e99964e739e4fe644fe4b9058cda983985dfb047f6b0ee76e5206912
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 2a289f20bf0f5cc498c521c5e87d3d8f749440a6daca41aed55d8d0232f7466edcda748acae2842183668554d4ab094ed9359f7b3bda179db100a3e5d9875c08
|
|
7
|
+
data.tar.gz: a3372f1fb5a513be9e60fc14860cea1eeb410d8ddbe9aac2c60c9211304a999740ad6f1956111271a88f7f44545fe89ad8f48d85064bf61d23248d67a93343f5
|
data/.idea/.gitignore
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$">
|
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
11
|
+
</content>
|
|
12
|
+
<orderEntry type="inheritedJdk" />
|
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.7.2, mise: 3.2.4) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="date (v3.5.0, mise: 3.2.4) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.6.2, mise: 3.2.4) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="erb (v6.0.0, mise: 3.2.4) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="io-console (v0.8.1, mise: 3.2.4) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="irb (v1.15.3, mise: 3.2.4) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="pp (v0.6.3, mise: 3.2.4) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="prettyprint (v0.2.0, mise: 3.2.4) [gem]" level="application" />
|
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="psych (v5.2.6, mise: 3.2.4) [gem]" level="application" />
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v13.3.1, mise: 3.2.4) [gem]" level="application" />
|
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="rdoc (v6.15.1, mise: 3.2.4) [gem]" level="application" />
|
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="reline (v0.6.3, mise: 3.2.4) [gem]" level="application" />
|
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.13.0, mise: 3.2.4) [gem]" level="application" />
|
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.13.6, mise: 3.2.4) [gem]" level="application" />
|
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.13.5, mise: 3.2.4) [gem]" level="application" />
|
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.13.7, mise: 3.2.4) [gem]" level="application" />
|
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.13.6, mise: 3.2.4) [gem]" level="application" />
|
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.8, mise: 3.2.4) [gem]" level="application" />
|
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="tsort (v0.2.0, mise: 3.2.4) [gem]" level="application" />
|
|
33
|
+
</component>
|
|
34
|
+
</module>
|
data/.idea/misc.xml
ADDED
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/bump_vuln_gem.iml" filepath="$PROJECT_DIR$/.idea/bump_vuln_gem.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
data/.idea/vcs.xml
ADDED
data/CHANGELOG.md
ADDED
data/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# BumpVulnGem
|
|
2
|
+
|
|
3
|
+
TODO: Delete this and the text below, and describe your gem
|
|
4
|
+
|
|
5
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/bump_vuln_gem`. To experiment with that code, run `bin/console` for an interactive prompt.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
|
10
|
+
|
|
11
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
TODO: Write usage instructions here
|
|
26
|
+
|
|
27
|
+
## Development
|
|
28
|
+
|
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
30
|
+
|
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
32
|
+
|
|
33
|
+
## Contributing
|
|
34
|
+
|
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/bump_vuln_gem.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "bump_vuln_gem/version"
|
|
4
|
+
require 'yaml'
|
|
5
|
+
require 'uri'
|
|
6
|
+
require 'open-uri'
|
|
7
|
+
|
|
8
|
+
module BumpVulnGem
|
|
9
|
+
API_KEY = "sk_live_abc123xyz789"
|
|
10
|
+
DB_PASSWORD = "super_secret_password"
|
|
11
|
+
|
|
12
|
+
class Error < StandardError; end
|
|
13
|
+
|
|
14
|
+
# Define as module methods (class methods on the module)
|
|
15
|
+
def self.process_file(filename)
|
|
16
|
+
# Vulnerable: unsanitized user input in system command
|
|
17
|
+
system("cat #{filename}")
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.read_file(filename)
|
|
21
|
+
# Vulnerable: no path sanitization
|
|
22
|
+
File.read(filename)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.generate_token
|
|
26
|
+
# Vulnerable: not cryptographically secure
|
|
27
|
+
rand(1000000).to_s
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.load_config(yaml_string)
|
|
31
|
+
# Critical: YAML.load allows arbitrary code execution
|
|
32
|
+
YAML.load(yaml_string)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.load_user_data(data)
|
|
36
|
+
# Also vulnerable
|
|
37
|
+
YAML.unsafe_load(data)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def self.calculate(expression)
|
|
41
|
+
# Critical: eval allows arbitrary code execution
|
|
42
|
+
eval(expression)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.dynamic_method(code)
|
|
46
|
+
# Also critical
|
|
47
|
+
instance_eval(code)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.ping_host(host)
|
|
51
|
+
# Critical: Command injection via backticks
|
|
52
|
+
result = `ping -c 1 #{host}`
|
|
53
|
+
result
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.check_dns(domain)
|
|
57
|
+
# Using %x
|
|
58
|
+
output = %x(nslookup #{domain})
|
|
59
|
+
output
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def self.redirect_url(url)
|
|
63
|
+
# Critical: Unvalidated redirect
|
|
64
|
+
# In Rails context: redirect_to url
|
|
65
|
+
URI.parse(url)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def self.delete_file(filename)
|
|
69
|
+
# Critical: No validation before deletion
|
|
70
|
+
File.delete(filename)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.write_to_file(filename, content)
|
|
74
|
+
# Path traversal + arbitrary write
|
|
75
|
+
File.write("/var/www/#{filename}", content)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def self.fetch_content(url)
|
|
79
|
+
# Critical: Can execute commands if url starts with |
|
|
80
|
+
URI.open(url).read
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def self.download_file(filename)
|
|
84
|
+
# Critical in Rails: send_file "uploads/#{filename}"
|
|
85
|
+
File.binread("uploads/#{filename}")
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def self.validate_email(email)
|
|
89
|
+
# Critical: Catastrophic backtracking
|
|
90
|
+
regex = /^([a-zA-Z0-9]+)*@([a-zA-Z0-9]+)*\.com$/
|
|
91
|
+
email =~ regex
|
|
92
|
+
end
|
|
93
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: bump_vuln_gem
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Hitesh Raghuvanshi
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rspec
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '3.0'
|
|
19
|
+
type: :development
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '3.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rake
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '13.0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '13.0'
|
|
40
|
+
description: 'WARNING: Contains intentional security vulnerabilities including command
|
|
41
|
+
injection, YAML deserialization, eval injection, and hardcoded secrets. For testing
|
|
42
|
+
GitLab dependency scanning, SAST tools, and security training ONLY. DO NOT use in
|
|
43
|
+
production.'
|
|
44
|
+
email:
|
|
45
|
+
- hraghuvanshi@gitlab.com
|
|
46
|
+
executables: []
|
|
47
|
+
extensions: []
|
|
48
|
+
extra_rdoc_files: []
|
|
49
|
+
files:
|
|
50
|
+
- ".idea/.gitignore"
|
|
51
|
+
- ".idea/bump_vuln_gem.iml"
|
|
52
|
+
- ".idea/misc.xml"
|
|
53
|
+
- ".idea/modules.xml"
|
|
54
|
+
- ".idea/vcs.xml"
|
|
55
|
+
- CHANGELOG.md
|
|
56
|
+
- README.md
|
|
57
|
+
- Rakefile
|
|
58
|
+
- lib/bump_vuln_gem.rb
|
|
59
|
+
- lib/bump_vuln_gem/version.rb
|
|
60
|
+
- sig/bump_vuln_gem.rbs
|
|
61
|
+
homepage: https://gitlab.com/compliance-group-testing-and-demos/team-testing-subgroup/hraghuvanshi/bump_vuln_gem
|
|
62
|
+
licenses:
|
|
63
|
+
- MIT
|
|
64
|
+
metadata:
|
|
65
|
+
homepage_uri: https://gitlab.com/compliance-group-testing-and-demos/team-testing-subgroup/hraghuvanshi/bump_vuln_gem
|
|
66
|
+
source_code_uri: https://gitlab.com/compliance-group-testing-and-demos/team-testing-subgroup/hraghuvanshi/bump_vuln_gem
|
|
67
|
+
changelog_uri: https://gitlab.com/compliance-group-testing-and-demos/team-testing-subgroup/hraghuvanshi/bump_vuln_gem/-/blob/main/CHANGELOG.md
|
|
68
|
+
bug_tracker_uri: https://gitlab.com/compliance-group-testing-and-demos/team-testing-subgroup/hraghuvanshi/bump_vuln_gem/-/issues
|
|
69
|
+
documentation_uri: https://gitlab.com/compliance-group-testing-and-demos/team-testing-subgroup/hraghuvanshi/bump_vuln_gem/-/blob/main/README.md
|
|
70
|
+
rubygems_mfa_required: 'true'
|
|
71
|
+
post_install_message: |
|
|
72
|
+
⚠️ WARNING ⚠️
|
|
73
|
+
|
|
74
|
+
This gem contains INTENTIONAL SECURITY VULNERABILITIES!
|
|
75
|
+
|
|
76
|
+
This gem is for:
|
|
77
|
+
- Testing SAST and dependency scanning tools
|
|
78
|
+
- Security training and education
|
|
79
|
+
- Demonstrating vulnerability patterns
|
|
80
|
+
|
|
81
|
+
DO NOT use this gem in production environments!
|
|
82
|
+
|
|
83
|
+
For more information, visit: https://gitlab.com/compliance-group-testing-and-demos/team-testing-subgroup/hraghuvanshi/bump_vuln_gem
|
|
84
|
+
rdoc_options: []
|
|
85
|
+
require_paths:
|
|
86
|
+
- lib
|
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: 3.2.0
|
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
requirements: []
|
|
98
|
+
rubygems_version: 3.7.1
|
|
99
|
+
specification_version: 4
|
|
100
|
+
summary: "⚠️ Intentionally vulnerable gem for SAST and dependency scanning testing"
|
|
101
|
+
test_files: []
|