- dlopen with absolute path to prevent LD_LIBRARY_PATH attack
- add "x" to prevent symlink attack for recovery file creation
Change-Id: I5f94740e1fd7e1df6c711767d63b624d829b399b
Signed-off-by: Semun Lee <semun.lee@samsung.com>
const std::string& get_image_path_sym_name = "app2ext_usr_get_image_path";
const std::string& init_sym_name = "app2ext_init";
const std::string& deinit_sym_name = "app2ext_deinit";
-const std::string& LIBNAME = "libapp2ext.so.0";
+const std::string& LIBNAME = "/usr/lib/libapp2ext.so.0";
}
return true;
}
+ if (!plugin_info_.path().is_absolute()) {
+ LOG(WARNING) << "Plugin path should be an absolute path: "
+ << plugin_info_.path().c_str();
+ return false;
+ }
+
lib_handle_ = dlopen(plugin_info_.path().c_str(), RTLD_LAZY | RTLD_LOCAL);
if (!lib_handle_) {
LOG(WARNING) << "Failed to open library: " << plugin_info_.path().c_str()
}
bool RecoveryFile::WriteAndCommitFileContent() {
- FILE* handle = fopen(path_.c_str(), "w");
+ FILE* handle = fopen(path_.c_str(), "wx");
if (!handle) {
LOG(ERROR) << "Cannot write recovery file";
return false;