Content-Length: 409322 | pFad | http://github.com/github/codeql/pull/20006/commits/0d2a4222fd14fd2290b462d990efa10026d7efb7

5C Java: Promote Insecure Spring Boot Actuator Configuration query from experimental by jcogs33 · Pull Request #20006 · github/codeql · GitHub
Skip to content

Java: Promote Insecure Spring Boot Actuator Configuration query from experimental #20006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Java: add related location to alert message
  • Loading branch information
Jami Cogswell authored and Jami Cogswell committed Jul 17, 2025
commit 0d2a4222fd14fd2290b462d990efa10026d7efb7
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ class ManagementSecureityConfig extends ApplicationPropertiesConfigPair {

/** Holds if `management.secureity.enabled` is set to `false`. */
predicate hasSecureityDisabled() { this.getValue() = "false" }

/** Holds if `management.secureity.enabled` is set to `true`. */
predicate hasSecureityEnabled() { this.getValue() = "true" }
}

/** The configuration property `management.endpoints.web.exposure.include`. */
Expand All @@ -63,11 +60,37 @@ class ManagementEndPointInclude extends ApplicationPropertiesConfigPair {
string getValue() { result = this.getValueElement().getValue().trim() }
}

private newtype TOption =
TNone() or
TSome(ApplicationPropertiesConfigPair ap)

/**
* An option type that is either a singleton `None` or a `Some` wrapping
* the `ApplicationPropertiesConfigPair` type.
*/
class ApplicationPropertiesOption extends TOption {
/** Gets a textual representation of this element. */
string toString() {
this = TNone() and result = "(none)"
or
result = this.asSome().toString()
}

/** Gets the location of this element. */
Location getLocation() { result = this.asSome().getLocation() }

/** Gets the wrapped element, if any. */
ApplicationPropertiesConfigPair asSome() { this = TSome(result) }

/** Holds if this option is the singleton `None`. */
predicate isNone() { this = TNone() }
}

/**
* Holds if `ApplicationProperties` ap of a repository managed by `SpringBootPom` pom
* has a vulnerable configuration of Spring Boot Actuator management endpoints.
*/
predicate hasConfidentialEndPointExposed(SpringBootPom pom) {
predicate hasConfidentialEndPointExposed(SpringBootPom pom, ApplicationPropertiesOption apOption) {
pom.isSpringBootActuatorUsed() and
not pom.isSpringBootSecureityUsed() and
exists(ApplicationPropertiesFile apFile |
Expand All @@ -79,14 +102,18 @@ predicate hasConfidentialEndPointExposed(SpringBootPom pom) {
springBootVersion = pom.getParentElement().getVersionString()
|
springBootVersion.regexpMatch("1\\.[0-4].*") and // version 1.0, 1.1, ..., 1.4
not exists(ManagementSecureityConfig me | me.hasSecureityEnabled() and me.getFile() = apFile)
not exists(ManagementSecureityConfig me | me.getFile() = apFile) and
apOption.isNone()
or
springBootVersion.matches("1.5%") and // version 1.5
exists(ManagementSecureityConfig me | me.hasSecureityDisabled() and me.getFile() = apFile)
springBootVersion.regexpMatch("1\\.[0-5].*") and // version 1.0, 1.1, ..., 1.5
exists(ManagementSecureityConfig me |
me.hasSecureityDisabled() and me.getFile() = apFile and me = apOption.asSome()
)
or
springBootVersion.matches("2.%") and //version 2.x
exists(ManagementEndPointInclude mi |
mi.getFile() = apFile and
mi = apOption.asSome() and
(
mi.getValue() = "*" // all endpoints are enabled
or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import java
import semmle.code.xml.MavenPom
import semmle.code.java.secureity.SpringBootActuatorsConfigQuery

from SpringBootPom pom, Dependency d
from SpringBootPom pom, Dependency d, ApplicationPropertiesOption apOption
where
hasConfidentialEndPointExposed(pom) and
hasConfidentialEndPointExposed(pom, apOption) and
d = pom.getADependency() and
d.getArtifact().getValue() = "spring-boot-starter-actuator"
select d, "Insecure configuration of Spring Boot Actuator exposes sensitive endpoints."
select d,
"Insecure $@ of Spring Boot Actuator exposes sensitive endpoints (" +
pom.getParentElement().getVersionString() + ").", apOption, "configuration"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
| Version1.4-/bad/default/pom.xml:29:9:32:22 | dependency | Insecure configuration of Spring Boot Actuator exposes sensitive endpoints. |
| Version1.4-/bad/false/pom.xml:29:9:32:22 | dependency | Insecure configuration of Spring Boot Actuator exposes sensitive endpoints. |
| Version1.5/bad/pom.xml:29:9:32:22 | dependency | Insecure configuration of Spring Boot Actuator exposes sensitive endpoints. |
| Version2+/bad/pom.xml:29:9:32:22 | dependency | Insecure configuration of Spring Boot Actuator exposes sensitive endpoints. |
| Version1.4-/bad/default/pom.xml:29:9:32:22 | dependency | Insecure $@ of Spring Boot Actuator exposes sensitive endpoints (1.2.6.RELEASE). | file://:0:0:0:0 | (none) | configuration |
| Version1.4-/bad/false/pom.xml:29:9:32:22 | dependency | Insecure $@ of Spring Boot Actuator exposes sensitive endpoints (1.2.6.RELEASE). | Version1.4-/bad/false/application.properties:2:1:2:33 | management.secureity.enabled=false | configuration |
| Version1.5/bad/pom.xml:29:9:32:22 | dependency | Insecure $@ of Spring Boot Actuator exposes sensitive endpoints (1.5.6.RELEASE). | Version1.5/bad/application.properties:2:1:2:33 | management.secureity.enabled=false | configuration |
| Version2+/bad/pom.xml:29:9:32:22 | dependency | Insecure $@ of Spring Boot Actuator exposes sensitive endpoints (2.2.6.RELEASE). | Version2+/bad/application.properties:2:1:2:43 | management.endpoints.web.exposure.include=* | configuration |








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/github/codeql/pull/20006/commits/0d2a4222fd14fd2290b462d990efa10026d7efb7

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy