【问题标题】:Getting warning from security analysis "Remove the compiler option -rpath to remove @rpath"从安全分析中获得警告“删除编译器选项 -rpath 以删除 @rpath”
【发布时间】:2021-01-31 05:09:58
【问题描述】:

我对我的 IOS 应用进行了质量扫描分析。我收到以下警告:

The binary has Runpath Search Path (@rpath) set. In certain cases an attacker can abuse this feature to run arbitrary executable for code execution and privilege escalation. Remove the compiler option -rpath to remove @rpath.  

我搜索了@rpath 并在我的pod-framework.sh 中找到了我找到的以下代码:

# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
  if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
    local swift_runtime_libs
    swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
    for lib in $swift_runtime_libs; do
      echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
      rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
      code_sign_if_enabled "${destination}/${lib}"
    done
  fi  

那么我可以删除此代码吗?会影响我的项目吗?

提前致谢。

【问题讨论】:

    标签: swift cocoapods ios14 xcode12


    【解决方案1】:

    鉴于 Xcode 7 已超过 5 年,并且应用商店提交至少需要 Xcode 11,删除该代码似乎是安全的。

    但是,鉴于不应运行脚本代码,二进制文件中的@rpath 可能来自其他东西。

    【讨论】:

    • 每次安装pod的时候都会添加吗?
    猜你喜欢
    • 1970-01-01
    • 2022-11-22
    • 1970-01-01
    • 1970-01-01
    • 2016-05-09
    • 2021-07-21
    • 1970-01-01
    • 2021-12-09
    • 1970-01-01
    相关资源
    最近更新 更多