環境配置 gateway
Spring Cloud : 這個就是分布式的微服務組件? ? ?
微服務 : 一般指的是獨立的,專注于一項功能的服務
Gateway 這個其實是個云端的網關配置(他的作用就是對訪問web的流量進行防護比如一些爬蟲的阻截)
新建項目的時候選擇:
以上兩個
新建項目的時候選擇 cloudRounting 下的Gateway
和ops下的監控<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId><version>3.1.0</version>
</dependency>
配置一些pom.xml
還有一個配置就是配置上 Gateway的 yml
application.yml
server:port: 8081management:endpoints:web:exposure:include: gatewayendpoint:gateway:enabled: true
spring:cloud:gateway:routes:- id: baiduuri: 'https://www.baidu.com/'order: 8000predicates:- Path=/skip/baidufilters:- StripPrefix=2
更改springboot版本:
<spring-boot.version>2.5.2</spring-boot.version>
<spring-cloud.version>2020.0.3</spring-cloud.version>
配置好之后直接運行 :
訪問監控器 如果這是個正常的情況說明 對方的Actuator配置的非常好
但是這個 Gateway也是可以造成Spel注入漏洞的
前提條件就是對方需要開啟了監控模式的同時 gateway配置端口泄露?
利用 :
Swagger配置和api的利用
簡介 :
什么是??Swagger?
它的作用就是 對項目進行提前的測試運行到web中,這個api主要的作用就是進行測試項目各個頁面的它在開發的作用就是進行api接口的測試 api在正常情況下是隱藏的 但是這個依賴項是可以對其進行測試的 因為api有很多的接口 使用這個可以更簡單的進行測試
這個功能類似于 :java自帶的自我檢測接口(接口就是指有參數能讓web頁面變化的東西)
使用Fafo 進行搜索 :
配置
新建項目的時候只需要選擇一個
pom文件
1、引入依賴
先引用 2.9版本的
<--2.9.2版本-->
<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger2</artifactId><version>2.9.2</version>
</dependency>
<dependency><groupId>io.springfox</groupId><artifactId>springfox-swagger-ui</artifactId><version>2.9.2</version>
</dependency>
不同版本的服務端不同 :/swagger-ui.html<--3.0.0版本-->
<dependency><groupId>io.springfox</groupId><artifactId>springfox-boot-starter</artifactId><version>3.0.0</version>
</dependency>/swagger-ui/index.html
2、 服務配置 :@EnableSwagger 第幾版本就寫幾 如 @EnableSwagger23、配置訪問
#application.properties
spring.mvc.pathmatch.matching-strategy=ant-path-matcher
或
#application.yml
springmvc:pathmatch:matching-strategy: ant_path_matcher
注意一點就是 不要把 SpringBootApplication刪掉 這個是spring必須有的東西
運行:
利用介紹
例如這個?這些是api接口的參數 我們可以通過操作參數來測試其安全性
但是大規模的參數我們怎么辨別敏感的:就是通過參數的名字或者api的名字 如api的名字是 user admin等
練習 :
這邊建一個 RCE的利用文件
這樣就能觸發 whoami
但是在
這么多接口面前 就需要使用工具進行api的分析
工具分析Swagger api 接口
使用 :
導入之后就能在接口找到
然后把接口的數據進行導入到測試項目去