logstash-integration-jdbc 5.6.4 → 5.6.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0434f8f19d3cb7df52955e6263c639acbf7edf1e8007f6eca2f0428c63d7794
4
- data.tar.gz: 1a741166ce8d2e83a1d32d727448042fd2fd3b801635528b67c40ca79733f608
3
+ metadata.gz: eac183602ce5afc76404907cd4c036ffb9e2e0eabf2a76f7e88376f02f00fcc4
4
+ data.tar.gz: 6ec50d6c8be70666a4b1c5eb744d90a6b4dac2177f7664d13a8df2376d3f0661
5
5
  SHA512:
6
- metadata.gz: 514915aa797a46b5ec6f167c69809773f110a848bfbd98a874f71fc6e145517c268768ecb1240bd82346ce9d26350f9e66ce1d3f1e39c07dc7b437410d061032
7
- data.tar.gz: eb4a71bdc9b67344f53ccf7a2502c50108e0ea2a746fa204b4f52a314c487def7fe9ae5cc3679f7811a7842f2e270e97ef1c281619309637b1f7fda0ee506f9c
6
+ metadata.gz: e5cd1957ceaed5f25dbc3b40004e0883af879a685d22c43d5fdba86a4536286c5563654436a7fc7a5f697a74b74cfeca918398e8b96038b596616f7da4b95b5f
7
+ data.tar.gz: bba5739ef235ffbed58d4beee96e2f5f60cec1df71b6a9fc4ed6eef145bc61c66272ee34401d13e5eca6f48a4319218c3ad31e0d2329a9f6a95ebdb692d96c83
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.6.6
2
+ - Fix access method to big tables to avoid materialise the full result set in memory and generate an out-of-memory error. [#204](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/204)
3
+
4
+ ## 5.6.5
5
+ - Prevent concurrent Sequel JDBC subadapter initialization races by preloading adapter at driver load time [#203](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/203)
6
+
1
7
  ## 5.6.4
2
8
  - Fix connection leak on statement retry by opening JDBC connection once outside retry loop [#201](https://github.com/logstash-plugins/logstash-integration-jdbc/pull/201)
3
9
 
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  Logstash Integration Plugin for JDBC, including Logstash Input and Filter Plugins
3
3
  # Logstash Plugin
4
4
 
5
- [![Travis Build Status](https://travis-ci.com/logstash-plugins/logstash-integration-jdbc.svg)](https://travis-ci.com/logstash-plugins/logstash-integration-jdbc)
5
+ [![Unit Tests](https://github.com/logstash-plugins/logstash-integration-jdbc/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/logstash-plugins/logstash-integration-jdbc/actions/workflows/unit-tests.yml)
6
6
 
7
7
  This is a plugin for [Logstash](https://github.com/elastic/logstash).
8
8
 
@@ -83,6 +83,10 @@ before retrieving more results from the result-set. This is configured in
83
83
  this plugin using the `jdbc_fetch_size` configuration option. No fetch size
84
84
  is set by default in this plugin, so the specific driver's default size will
85
85
  be used.
86
+ NOTE:
87
+ Each driver JDBC driver and backend has its own requirements for using server-side cursors.
88
+ Before using `jdbc_fetch_size`, check your driver's manual.
89
+ For example, the MySQL driver requires explicit opt-in via `useCursorFetch=true`, while the PostgreSQL driver simply requires that the fetch size is a positive integer.
86
90
 
87
91
  ==== Usage:
88
92
 
@@ -32,6 +32,7 @@ module LogStash module PluginMixins module Jdbc
32
32
  # concurrency related problems with multiple pipelines and multiple drivers
33
33
  DRIVERS_LOADING_LOCK.lock()
34
34
  begin
35
+ preload_sequel_jdbc_subadapter
35
36
  load_driver_jars
36
37
  begin
37
38
  @driver_impl = load_jdbc_driver_class
@@ -50,6 +51,24 @@ module LogStash module PluginMixins module Jdbc
50
51
  end
51
52
  end
52
53
 
54
+ def preload_sequel_jdbc_subadapter
55
+ subadapter = jdbc_subadapter_scheme
56
+ return unless subadapter
57
+
58
+ # Ensure first-time Sequel jdbc/<subadapter> loading happens serially.
59
+ Sequel::Database.load_adapter(subadapter, :map => Sequel::JDBC::DATABASE_SETUP, :subdir => 'jdbc')
60
+ rescue Sequel::AdapterNotFound
61
+ # Some JDBC URLs can work without a dedicated Sequel sub-adapter.
62
+ @logger.debug("Skipping Sequel JDBC sub-adapter preload", :subadapter => subadapter, :jdbc_connection_string => @jdbc_connection_string)
63
+ nil
64
+ end
65
+
66
+ def jdbc_subadapter_scheme
67
+ return nil unless @jdbc_connection_string
68
+
69
+ @jdbc_connection_string[/\Ajdbc:([^:]+):/, 1]&.downcase&.to_sym
70
+ end
71
+
53
72
  def load_driver_jars
54
73
  if jdbc_driver_library_set?
55
74
  @jdbc_driver_library.split(",").each do |driver_jar|
@@ -139,23 +139,16 @@ module LogStash module PluginMixins module Jdbc
139
139
  # @param sql_last_value [Integet|DateTime|Time]
140
140
  # @yieldparam row [Hash{Symbol=>Object}]
141
141
  def perform_query(db, sql_last_value)
142
- query = build_query(db, sql_last_value)
143
- query.each do |row|
144
- yield row
145
- end
146
- end
147
-
148
- private
149
-
150
- def build_query(db, sql_last_value)
151
142
  # under the scheduler the Sequel database instance is recreated each time
152
143
  # so the previous prepared statements are lost, add back
153
144
  prepared = db.prepared_statement(name)
154
- prepared ||= db[statement, *positional_bind_placeholders].prepare(:select, name)
145
+ prepared ||= db[statement, *positional_bind_placeholders].prepare(:each, name)
155
146
 
156
- prepared.call(positional_bind_mapping(sql_last_value))
147
+ prepared.call(positional_bind_mapping(sql_last_value)) { |row| yield row }
157
148
  end
158
149
 
150
+ private
151
+
159
152
  def create_positional_bind_mapping(bind_values_array)
160
153
  hash = {}
161
154
  bind_values_array.each_with_index {|v,i| hash[:"p#{i}"] = v}
@@ -2,6 +2,8 @@ require "logstash/devutils/rspec/spec_helper"
2
2
  require "logstash/inputs/jdbc"
3
3
  require "sequel"
4
4
  require "sequel/adapters/jdbc"
5
+ require "stud/temporary"
6
+ require_relative "security_statements_fixture"
5
7
 
6
8
 
7
9
  describe LogStash::Inputs::Jdbc, :integration => true do
@@ -13,6 +15,8 @@ describe LogStash::Inputs::Jdbc, :integration => true do
13
15
  jdbc_connection_string = ENV.fetch("PG_CONNECTION_STRING",
14
16
  "jdbc:postgresql://postgresql:5432") + "/jdbc_input_db?user=postgres"
15
17
 
18
+ OOM_NUM_ROWS = 1_000_000
19
+
16
20
  let(:settings) do
17
21
  { "jdbc_driver_class" => "org.postgresql.Driver",
18
22
  "jdbc_connection_string" => jdbc_connection_string,
@@ -134,5 +138,59 @@ describe LogStash::Inputs::Jdbc, :integration => true do
134
138
  expect{ plugin.run(q) }.not_to raise_error
135
139
  end
136
140
  end
141
+
142
+ context "when scanning #{OOM_NUM_ROWS} rows via a prepared statement (issue #198)" do
143
+ # Discards event objects so we never materialise OOM_NUM_ROWS Logstash events
144
+ # in heap — only the count matters for this assertion.
145
+ let(:queue) do
146
+ counter = java.util.concurrent.atomic.AtomicLong.new(0)
147
+ q = Object.new
148
+ q.define_singleton_method(:<<) { |_event| counter.increment_and_get }
149
+ q.define_singleton_method(:count) { counter.get }
150
+ q
151
+ end
152
+
153
+ let(:settings) do
154
+ {
155
+ "jdbc_driver_class" => "org.postgresql.Driver",
156
+ "jdbc_connection_string" => jdbc_connection_string,
157
+ "jdbc_driver_library" => "/usr/share/logstash/postgresql.jar",
158
+ "jdbc_user" => "postgres",
159
+ "jdbc_password" => ENV["POSTGRES_PASSWORD"],
160
+ "statement" => "SELECT * FROM security_statements",
161
+ "use_prepared_statements" => true,
162
+ "prepared_statement_name" => "security_scan_all",
163
+ "prepared_statement_bind_values" => [],
164
+ "last_run_metadata_path" => Stud::Temporary.pathname
165
+ }
166
+ end
167
+
168
+ before(:all) do
169
+ require "/usr/share/logstash/postgresql.jar"
170
+ db = Sequel.connect(jdbc_connection_string,
171
+ :user => "postgres", :password => ENV["POSTGRES_PASSWORD"])
172
+ SecurityStatementsFixture.populate(db, OOM_NUM_ROWS)
173
+ db.disconnect
174
+ end
175
+
176
+ after(:all) do
177
+ require "/usr/share/logstash/postgresql.jar"
178
+ db = Sequel.connect(jdbc_connection_string,
179
+ :user => "postgres", :password => ENV["POSTGRES_PASSWORD"])
180
+ SecurityStatementsFixture.clear_table(db)
181
+ db.disconnect
182
+ end
183
+
184
+ after(:each) do
185
+ plugin.stop rescue nil
186
+ end
187
+
188
+ it "reads all #{OOM_NUM_ROWS} rows exactly once without materialising the full result set" do
189
+ plugin.register
190
+ plugin.run(queue)
191
+
192
+ expect(queue.count).to eq(OOM_NUM_ROWS)
193
+ end
194
+ end
137
195
  end
138
196
 
@@ -0,0 +1,203 @@
1
+ # encoding: utf-8
2
+
3
+ # Shared fixture for the security_statements integration test table.
4
+ #
5
+ # Mirrors the data shape and seeded RNG from
6
+ # reproducer_198_OOM_on_prepared_statement/fill_db.java so that tests
7
+ # reproduce the original OOM scenario faithfully.
8
+ module SecurityStatementsFixture
9
+ BATCH_SIZE = 500
10
+
11
+ CVE_POOL = [
12
+ { cve_id: "CVE-2021-44228", score: 10.0,
13
+ title: "Log4Shell – Apache Log4j2 Remote Code Execution",
14
+ description: "Apache Log4j2 2.0-beta9 through 2.14.1 JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled.",
15
+ affected_products: "Apache Log4j2 2.0-beta9 through 2.14.1; all applications embedding Log4j2 in those versions including VMware vCenter, Cisco products, Elastic Stack, Minecraft Java Edition, and thousands of enterprise products.",
16
+ remediation: "Upgrade to Apache Log4j 2.15.0 or later. If immediate upgrade is not possible, set the system property 'log4j2.formatMsgNoLookups' to 'true' or remove the JndiLookup class from the classpath. Apply vendor-specific patches as released.",
17
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2021-44228, https://logging.apache.org/log4j/2.x/security.html, https://www.cisa.gov/known-exploited-vulnerabilities-catalog",
18
+ statement: "CRITICAL severity. Actively exploited in the wild since December 2021. CISA added to KEV catalog. Affects a vast number of Java-based enterprise products. Immediate patching required.",
19
+ reporter: "NVD / Apache Security Team" },
20
+
21
+ { cve_id: "CVE-2014-0160", score: 7.5,
22
+ title: "Heartbleed – OpenSSL TLS Heartbeat Information Disclosure",
23
+ description: "The TLS and DTLS implementations in OpenSSL 1.0.1 before 1.0.1g do not properly handle Heartbeat Extension packets, which allows remote attackers to obtain sensitive information from process memory via crafted packets that trigger a buffer over-read, as demonstrated by reading private keys.",
24
+ affected_products: "OpenSSL 1.0.1 through 1.0.1f; products using affected OpenSSL versions including nginx, Apache httpd, OpenVPN, and numerous VPN appliances and operating-system distributions.",
25
+ remediation: "Upgrade to OpenSSL 1.0.1g or later. Revoke and reissue all TLS certificates generated with vulnerable versions. Force password resets for services exposed during the vulnerable window. Enable Perfect Forward Secrecy.",
26
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2014-0160, https://heartbleed.com, https://www.openssl.org/news/secadv/20140407.txt",
27
+ statement: "HIGH severity. Allows passive exfiltration of private keys, session tokens, and credentials without leaving traces in server logs. Widely exploited. Certificates signed with compromised keys must be reissued.",
28
+ reporter: "NVD / Codenomicon / Google Security" },
29
+
30
+ { cve_id: "CVE-2017-0144", score: 8.1,
31
+ title: "EternalBlue – Windows SMBv1 Remote Code Execution",
32
+ description: "The SMBv1 server in Microsoft Windows Vista SP2, Windows Server 2008 SP2 and R2 SP1, Windows 7 SP1, Windows 8.1, Windows Server 2012 Gold and R2, Windows RT 8.1, and Windows 10 Gold, 1511, and 1600, and Windows Server 2016 allows remote attackers to execute arbitrary code via crafted packets.",
33
+ affected_products: "Microsoft Windows Vista, 7, 8.1, 10, Server 2008, 2012, 2016 with SMBv1 enabled.",
34
+ remediation: "Apply Microsoft Security Bulletin MS17-010. Disable SMBv1 protocol. Block inbound SMB traffic (TCP port 445) at the network perimeter. Deploy Windows Defender Credential Guard where applicable.",
35
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2017-0144, https://technet.microsoft.com/en-us/library/security/ms17-010.aspx",
36
+ statement: "HIGH severity. Exploited by WannaCry and NotPetya ransomware campaigns causing billions in damages. NSA exploit leaked by Shadow Brokers. Disable SMBv1 immediately even if patch cannot be applied.",
37
+ reporter: "NVD / Microsoft MSRC" },
38
+
39
+ { cve_id: "CVE-2014-6271", score: 9.8,
40
+ title: "ShellShock – GNU Bash Environment Variable RCE",
41
+ description: "GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment, as demonstrated through vectors involving the ForceCommand feature in OpenSSH, the mod_cgi and mod_cgid modules in Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution.",
42
+ affected_products: "GNU Bash versions through 4.3; CGI scripts on Apache/nginx, SSH ForceCommand setups, DHCP client hooks, Docker containers with Bash entrypoints.",
43
+ remediation: "Upgrade GNU Bash to version 4.3 patch 25 or later. Apply vendor OS patches. Audit all CGI scripts and shell-invocation paths. Prefer non-shell interpreters for network-facing scripts.",
44
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2014-6271, https://www.gnu.org/software/bash/",
45
+ statement: "CRITICAL severity. Trivial to exploit remotely via HTTP headers, DHCP options, or SSH. Worm-like propagation observed within hours of disclosure. Patch all Bash installations immediately.",
46
+ reporter: "NVD / Stephane Chazelas / Red Hat Security" },
47
+
48
+ { cve_id: "CVE-2022-22965", score: 9.8,
49
+ title: "Spring4Shell – Spring Framework RCE via Data Binding",
50
+ description: "A Spring MVC or Spring WebFlux application running on JDK 9+ may be vulnerable to remote code execution via data binding. The specific exploit requires the application to run on Tomcat as a WAR deployment. If the application is deployed as a Spring Boot executable jar (default), it is not vulnerable to the exploit.",
51
+ affected_products: "Spring Framework 5.3.0 to 5.3.17, 5.2.0 to 5.2.19 and older versions; applications deployed as WAR on Apache Tomcat running JDK 9 or higher.",
52
+ remediation: "Upgrade to Spring Framework 5.3.18+ or 5.2.20+. For Spring Boot users, upgrade to 2.6.6 or 2.5.12. Alternatively, add @InitBinder to disallow binding of class and classLoader fields.",
53
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2022-22965, https://spring.io/blog/2022/03/31/spring-framework-rce-early-announcement",
54
+ statement: "CRITICAL severity. Unauthenticated RCE in a widely used Java framework. PoC exploit publicly available. Assess WAR deployments on Tomcat + JDK9+ as the highest priority.",
55
+ reporter: "NVD / Spring Security Team" },
56
+
57
+ { cve_id: "CVE-2019-0708", score: 9.8,
58
+ title: "BlueKeep – Windows Remote Desktop Services Pre-Auth RCE",
59
+ description: "A remote code execution vulnerability exists in Remote Desktop Services when an unauthenticated attacker connects to the target system using RDP and sends specially crafted requests. This vulnerability is pre-authentication and requires no user interaction.",
60
+ affected_products: "Windows XP, Windows 7, Windows Server 2003, Windows Server 2008 and R2 with RDP exposed.",
61
+ remediation: "Apply Microsoft patch KB4499175 (Windows 7) or equivalent. Enable Network Level Authentication. Block TCP port 3389 at the network perimeter. Consider disabling RDP if not required.",
62
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2019-0708, https://portal.msrc.microsoft.com/en-US/security-guidance/advisory/CVE-2019-0708",
63
+ statement: "CRITICAL severity. Wormable vulnerability similar in character to MS17-010. NSA publicly urged patching. Metasploit module available. Prioritize internet-exposed RDP systems.",
64
+ reporter: "NVD / Microsoft MSRC" },
65
+
66
+ { cve_id: "CVE-2021-26855", score: 9.1,
67
+ title: "ProxyLogon – Microsoft Exchange Server SSRF",
68
+ description: "Microsoft Exchange Server is vulnerable to a server-side request forgery (SSRF) vulnerability that allows attackers to send arbitrary HTTP requests and authenticate as the Exchange server, bypassing authentication. Used as the initial vector in the ProxyLogon exploit chain.",
69
+ affected_products: "Microsoft Exchange Server 2013 CU23, Exchange Server 2016 CU18/CU19, Exchange Server 2019 CU7/CU8.",
70
+ remediation: "Install Microsoft Security Update KB5000871 immediately. If patching is impossible, run Microsoft's mitigation script. Audit Exchange IIS logs for indicators of compromise (IOCs) provided by Microsoft.",
71
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2021-26855, https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-26855, https://www.microsoft.com/security/blog/2021/03/02/hafnium-targeting-exchange-servers/",
72
+ statement: "CRITICAL severity. Chained with CVE-2021-27065 for post-auth RCE, enabling webshell deployment. Attributed to HAFNIUM threat group. Tens of thousands of Exchange servers compromised. Emergency patch required.",
73
+ reporter: "NVD / Microsoft MSRC / Volexity" },
74
+
75
+ { cve_id: "CVE-2021-34527", score: 8.8,
76
+ title: "PrintNightmare – Windows Print Spooler Privilege Escalation / RCE",
77
+ description: "Windows Print Spooler Remote Code Execution Vulnerability. The Windows Print Spooler service improperly performs privileged file operations. An attacker who successfully exploits this vulnerability could run arbitrary code with SYSTEM privileges. Attack vectors include both remote (via SMB) and local.",
78
+ affected_products: "All supported Windows versions with Print Spooler service running (enabled by default).",
79
+ remediation: "Apply Microsoft cumulative updates released July 2021. As an interim measure, disable the Print Spooler service on domain controllers and systems that do not need printing. Restrict inbound SMB traffic.",
80
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2021-34527, https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-34527",
81
+ statement: "HIGH severity. PoC published on GitHub before patch availability. Widely used by ransomware operators for lateral movement and privilege escalation. Disable Print Spooler on DCs immediately.",
82
+ reporter: "NVD / Microsoft MSRC" },
83
+
84
+ { cve_id: "CVE-2022-30190", score: 7.8,
85
+ title: "Follina – Microsoft Support Diagnostic Tool RCE",
86
+ description: "A remote code execution vulnerability exists when MSDT is called using the URL protocol from a calling application such as Word. An attacker who successfully exploits this vulnerability can run arbitrary code with the privileges of the calling application.",
87
+ affected_products: "Windows 7 through 11, Windows Server 2008 through 2022 with Microsoft Support Diagnostic Tool (MSDT).",
88
+ remediation: "Apply June 2022 Patch Tuesday updates. As interim mitigation, disable MSDT URL protocol by deleting or renaming the HKEY_CLASSES_ROOT\\ms-msdt registry key. Configure Attack Surface Reduction rules.",
89
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2022-30190, https://msrc.microsoft.com/update-guide/vulnerability/CVE-2022-30190",
90
+ statement: "HIGH severity. Exploited via malicious Office documents and RTF files without requiring macros. No user interaction beyond opening the document. Observed in campaigns by TA570 and state-sponsored actors.",
91
+ reporter: "NVD / Microsoft MSRC / nao_sec" },
92
+
93
+ { cve_id: "CVE-2016-5195", score: 7.8,
94
+ title: "Dirty COW – Linux Kernel Privilege Escalation",
95
+ description: "Race condition in mm/gup.c in the Linux kernel before 4.8.3 allows local users to gain privileges by leveraging incorrect handling of a copy-on-write (COW) feature to write to a read-only memory mapping.",
96
+ affected_products: "Linux kernel 2.x through 4.x before 4.8.3; Android devices running affected kernel versions; all major Linux distributions prior to vendor patches.",
97
+ remediation: "Upgrade to Linux kernel 4.8.3 or later. Apply distribution-specific patches (RHEL, Ubuntu, Debian, CentOS). For Android devices, apply vendor-specific security patches. Reboot required after patching.",
98
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2016-5195, https://dirtycow.ninja/",
99
+ statement: "HIGH severity. Nine-year-old vulnerability in the Linux kernel. Reliable public exploits for multiple architectures. Actively exploited in Android malware. Patch and reboot all Linux systems.",
100
+ reporter: "NVD / Phil Oester / Linux Kernel Security Team" },
101
+
102
+ { cve_id: "CVE-2017-5753", score: 5.6,
103
+ title: "Spectre Variant 1 – Bounds Check Bypass",
104
+ description: "Systems with microprocessors utilizing speculative execution and branch prediction may allow unauthorized disclosure of information to an attacker with local user access via a side-channel analysis of the data cache. Affects Intel, AMD, and ARM processors.",
105
+ affected_products: "All modern CPUs with speculative execution: Intel Core (generations 2+), AMD Ryzen/EPYC, ARM Cortex-A series; cloud hypervisors exposing shared CPU resources.",
106
+ remediation: "Apply OS and hypervisor patches for Spectre mitigations (KPTI, Retpoline). Update browser engines to reduce timer resolution and disable SharedArrayBuffer. Apply CPU microcode updates where available.",
107
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2017-5753, https://spectreattack.com/",
108
+ statement: "MEDIUM severity (per NVD). Fundamental CPU architectural vulnerability with no full software fix. Performance overhead from mitigations is workload-dependent (2-30%). Ongoing mitigation strategy required.",
109
+ reporter: "NVD / Google Project Zero / Graz University of Technology" },
110
+
111
+ { cve_id: "CVE-2017-5754", score: 5.6,
112
+ title: "Meltdown – Rogue Data Cache Load",
113
+ description: "Systems with microprocessors utilizing speculative execution and indirect branch prediction may allow unauthorized disclosure of information to an attacker with local user access via a side-channel analysis of the data cache. Allows user-mode code to read kernel memory.",
114
+ affected_products: "Intel processors (most Core i3/i5/i7/i9 since ~2010); some ARM Cortex-A processors. AMD processors not believed to be affected by the original Meltdown variant.",
115
+ remediation: "Apply Kernel Page-Table Isolation (KPTI) patches from OS vendors. Update hypervisors. Apply CPU microcode updates. Monitor for performance regressions in I/O-intensive workloads.",
116
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2017-5754, https://meltdownattack.com/",
117
+ statement: "MEDIUM severity (per NVD). Allows reading arbitrary kernel memory from user space, exposing passwords, encryption keys, and other sensitive data. KPTI patches carry measurable overhead. Patch immediately.",
118
+ reporter: "NVD / Google Project Zero / Graz University of Technology" },
119
+
120
+ { cve_id: "CVE-2023-44487", score: 7.5,
121
+ title: "HTTP/2 Rapid Reset – DDoS Amplification",
122
+ description: "The HTTP/2 protocol allows a denial of service (server resource consumption) because request cancellation can reset many streams quickly, as exploited in the wild in August through October 2023.",
123
+ affected_products: "All HTTP/2 server implementations including nginx, Apache httpd, Microsoft IIS, Go net/http, Node.js, Tomcat, and cloud load balancers.",
124
+ remediation: "Apply patches from web server and runtime vendors. Implement connection-level rate limiting. Set SETTINGS_MAX_CONCURRENT_STREAMS to a low value (e.g., 100). Use a CDN or DDoS mitigation service.",
125
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2023-44487, https://cloud.google.com/blog/products/identity-security/how-it-works-the-novel-http2-rapid-reset-ddos-attack",
126
+ statement: "HIGH severity. Exploited to generate record-breaking DDoS attacks exceeding 398 million requests/second. Requires no authentication. Apply HTTP/2 server patches and rate-limit RST_STREAM frames urgently.",
127
+ reporter: "NVD / Google / Cloudflare / Amazon" },
128
+
129
+ { cve_id: "CVE-2023-23397", score: 9.8,
130
+ title: "Microsoft Outlook NTLM Hash Leak – Zero-Click",
131
+ description: "Microsoft Outlook elevation of privilege vulnerability. A specially crafted email with a UNC path triggers an NTLM authentication request to an attacker-controlled server when Outlook renders the reminder, with no user interaction required beyond receiving the email.",
132
+ affected_products: "Microsoft Outlook for Windows (all supported versions). Exchange Online users are partially protected by email filtering but on-premises delivery may not strip the malicious header.",
133
+ remediation: "Apply March 2023 Patch Tuesday update (KB5002333 or equivalent). Add users to the Protected Users AD group. Block outbound SMB (TCP 445) at the perimeter. Use the Microsoft script to check for exploitation IOCs.",
134
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2023-23397, https://msrc.microsoft.com/update-guide/vulnerability/CVE-2023-23397",
135
+ statement: "CRITICAL severity. Zero-click, pre-interaction exploit. Attributed to Russian APT28 (Fancy Bear). Harvested NTLM hashes can be used for Pass-the-Hash or relayed attacks. Patch Outlook immediately.",
136
+ reporter: "NVD / Microsoft MSRC / CERT-UA" },
137
+
138
+ { cve_id: "CVE-2024-3094", score: 10.0,
139
+ title: "XZ Utils Backdoor – Supply Chain Attack",
140
+ description: "Malicious code was discovered in the upstream tarballs of xz, starting with version 5.6.0. The backdoored liblzma allows an attacker to break RSA key validation in sshd, enabling unauthorized remote access on affected systems.",
141
+ affected_products: "XZ Utils versions 5.6.0 and 5.6.1 as distributed in rolling-release Linux distributions (Fedora Rawhide, Debian unstable/experimental, openSUSE Tumbleweed, Arch Linux, Kali Linux, Gentoo) between Feb-Mar 2024.",
142
+ remediation: "Downgrade xz-utils to version 5.4.x immediately. Verify binary integrity against trusted repositories. Rotate SSH host keys and audit SSH access logs on potentially affected systems.",
143
+ references: "https://nvd.nist.gov/vuln/detail/CVE-2024-3094, https://www.openwall.com/lists/oss-security/2024/03/29/4",
144
+ statement: "CRITICAL severity. Supply chain attack discovered fortuitously by a Microsoft engineer via anomalous CPU usage. Multi-year, nation-state-level sophistication. Only stable distributions were not affected.",
145
+ reporter: "NVD / Andres Freund / Red Hat Security" }
146
+ ].freeze
147
+
148
+ EXTRA_NOTES = [
149
+ "Coordinated disclosure followed. Vendor responded within 90 days.",
150
+ "Public exploit code available on GitHub and Exploit-DB. Treat as actively exploited.",
151
+ "No known public exploits at time of advisory publication.",
152
+ "Exploitation requires local access; network-based exploitation not demonstrated.",
153
+ "CISA Added to Known Exploited Vulnerabilities catalog. Federal agencies have 72 hours to remediate.",
154
+ "Bug bounty awarded: $10,000 via HackerOne.",
155
+ "Discovered during routine internal red team exercise.",
156
+ "Vendor disputed severity; NVD score reflects independent analysis.",
157
+ "Workaround available; full patch expected in next quarterly release.",
158
+ "CVSS environmental score may differ based on deployment configuration.",
159
+ "Actively targeted by ransomware affiliate groups as of last threat intel update.",
160
+ "Proof-of-concept released 7 days after patch; exploitation observed within 24 hours of PoC.",
161
+ "No authentication required for exploitation; internet-exposed instances at highest risk.",
162
+ "Dual use: same technique used in legitimate penetration testing tooling.",
163
+ "Fix introduced a regression; patched again in the following minor release."
164
+ ].freeze
165
+
166
+ module_function
167
+
168
+ def populate(db, num_rows)
169
+ rng = Random.new(42)
170
+ statuses = %w[affected non_affected]
171
+
172
+ puts "\nInserting #{num_rows} rows into security_statements…"
173
+ start = Time.now
174
+
175
+ (0...num_rows).each_slice(BATCH_SIZE) do |slice|
176
+ rows = slice.map do
177
+ cve = CVE_POOL[rng.rand(CVE_POOL.size)]
178
+ raw = cve[:score] + (rng.rand - 0.5) * 2.0
179
+ score = [[raw, 0.0].max, 10.0].min.round(1)
180
+ {
181
+ cve_id: cve[:cve_id],
182
+ score: score,
183
+ status: statuses[rng.rand(2)],
184
+ statement: cve[:statement],
185
+ title: cve[:title],
186
+ description: cve[:description],
187
+ affected_products: cve[:affected_products],
188
+ remediation: cve[:remediation],
189
+ references: cve[:references],
190
+ reporter: cve[:reporter],
191
+ notes: EXTRA_NOTES[rng.rand(EXTRA_NOTES.size)]
192
+ }
193
+ end
194
+ db[:security_statements].multi_insert(rows)
195
+ end
196
+
197
+ puts "Done: #{num_rows} rows in #{'%.1f' % (Time.now - start)}s"
198
+ end
199
+
200
+ def clear_table(db)
201
+ db.run("TRUNCATE TABLE security_statements")
202
+ end
203
+ end
@@ -1907,4 +1907,54 @@ describe LogStash::Inputs::Jdbc do
1907
1907
  end
1908
1908
  end
1909
1909
  end
1910
+
1911
+ describe "jdbc adapter preloading", :no_connection do
1912
+ before do
1913
+ allow(plugin).to receive(:load_jdbc_driver_class).and_return(double("driver_class"))
1914
+ end
1915
+
1916
+ it "extracts jdbc sub-adapter scheme in lowercase" do
1917
+ plugin.instance_variable_set(:@jdbc_connection_string, "jdbc:Oracle:thin:@//localhost:1521/FREEPDB1")
1918
+
1919
+ expect(plugin.send(:jdbc_subadapter_scheme)).to eq(:oracle)
1920
+ end
1921
+
1922
+ it "preloads sequel jdbc sub-adapter for jdbc URLs" do
1923
+ expect(Sequel::Database).to receive(:load_adapter).with(:derby, :map => Sequel::JDBC::DATABASE_SETUP, :subdir => 'jdbc').and_call_original
1924
+
1925
+ plugin.send(:load_driver)
1926
+ end
1927
+
1928
+ it "uses normalized jdbc sub-adapter scheme while preloading" do
1929
+ plugin.instance_variable_set(:@jdbc_connection_string, "jdbc:Oracle:thin:@//localhost:1521/FREEPDB1")
1930
+
1931
+ expect(Sequel::Database).to receive(:load_adapter).with(:oracle, :map => Sequel::JDBC::DATABASE_SETUP, :subdir => 'jdbc').and_return(nil)
1932
+
1933
+ expect { plugin.send(:load_driver) }.not_to raise_error
1934
+ end
1935
+
1936
+ it "does not try to preload when URL is not jdbc" do
1937
+ plugin.instance_variable_set(:@jdbc_connection_string, "mock://localhost:1527/db")
1938
+
1939
+ expect(Sequel::Database).not_to receive(:load_adapter)
1940
+
1941
+ plugin.send(:load_driver)
1942
+ end
1943
+
1944
+ it "ignores unknown jdbc sub-adapters" do
1945
+ plugin.instance_variable_set(:@jdbc_connection_string, "jdbc:unknown://localhost:1527/db")
1946
+
1947
+ expect(Sequel::Database).to receive(:load_adapter).with(:unknown, :map => Sequel::JDBC::DATABASE_SETUP, :subdir => 'jdbc').and_raise(Sequel::AdapterNotFound)
1948
+
1949
+ expect { plugin.send(:load_driver) }.not_to raise_error
1950
+ end
1951
+
1952
+ it "treats nil-returning jdbc sub-adapter load as a no-op" do
1953
+ plugin.instance_variable_set(:@jdbc_connection_string, "jdbc:unknown://localhost:1527/db")
1954
+
1955
+ expect(Sequel::Database).to receive(:load_adapter).with(:unknown, :map => Sequel::JDBC::DATABASE_SETUP, :subdir => 'jdbc').and_return(nil)
1956
+
1957
+ expect { plugin.send(:load_driver) }.not_to raise_error
1958
+ end
1959
+ end
1910
1960
  end
data/version CHANGED
@@ -1 +1 @@
1
- 5.6.4
1
+ 5.6.6
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-integration-jdbc
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.4
4
+ version: 5.6.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-07-21 00:00:00.000000000 Z
10
+ date: 2026-08-27 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: logstash-core-plugin-api
@@ -278,6 +278,7 @@ files:
278
278
  - spec/helpers/WHY-THIS-JAR.txt
279
279
  - spec/helpers/derbyrun.jar
280
280
  - spec/inputs/integration/integ_spec.rb
281
+ - spec/inputs/integration/security_statements_fixture.rb
281
282
  - spec/inputs/jdbc_spec.rb
282
283
  - spec/plugin_mixins/jdbc/timezone_proxy_spec.rb
283
284
  - spec/plugin_mixins/jdbc/value_tracking_spec.rb
@@ -333,6 +334,7 @@ test_files:
333
334
  - spec/helpers/WHY-THIS-JAR.txt
334
335
  - spec/helpers/derbyrun.jar
335
336
  - spec/inputs/integration/integ_spec.rb
337
+ - spec/inputs/integration/security_statements_fixture.rb
336
338
  - spec/inputs/jdbc_spec.rb
337
339
  - spec/plugin_mixins/jdbc/timezone_proxy_spec.rb
338
340
  - spec/plugin_mixins/jdbc/value_tracking_spec.rb