有很多关于addslashes和mysql_real_escape函数如何防止注入安全的讨论.事实上,即使像Wordpress这样的大型框架或CMS正在使用这些功能,他们到目前为止还做了一项神工作.
我知道在使用GBK字符集时有一些特殊情况,或者可以使用utf8_decode来注入一些sql代码,或者1' OR 1 --在有简单涉及的地方时可以使用这样的一些简单示例.
然而,经过一些研究后,如果charset是UTF-8并且让我们承认,使用addslashes或mysql_real_escape这样的简单查询就很难注入,这是最常见的情况.
所以,鉴于这个新手脚本,请提供一个sql注入POC(记住UTF-8 charset)
$mysql['username'] = addslashes($_POST['username']);
$mysql['password'] = addslashes($_POST['password']);
$sql = "SELECT *
FROM users
WHERE username = '{$mysql['username']}'
AND password = '{$mysql['password']}'";
Run Code Online (Sandbox Code Playgroud)
更新 - 我只需要一个简单的例子,而不是完整的流程披露.即使谷歌的链接可能会工作.
AFAIK在使用用户数据时,电子邮件的HEADERS中只有一个漏洞吗?
我使用下面的函数来清理我的数据,但是我在页面上有一些textarea字段,因此这些字段可能包含换行符..所以想知道这个用户数据是否只会放在电子邮件的正文中,可以吗没有被消毒的麻烦 - 除了剥离HTML当然?
这是功能:
function is_injected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if (preg_match($inject,$str)) {
return true;
} else {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
作为旁注,令人惊讶的是目前没有邮件注入/电子邮件注入的标签.
我正在尝试使用Linux故障注入框架来注入页面分配错误.我正在尝试使用failcmd.shLinux内核提供的脚本tools/testing/fault-injection/.
设置变量FAILCMD_TYPE后fail_page_alloc,我正在运行以下命令:
./failcmd.sh --times=-1 --interval=1 --verbose=2 <program_to_be_run_with_fi>.
Run Code Online (Sandbox Code Playgroud)
我尝试过的所有程序运行良好,虽然我将详细设置为2,但我没有得到任何调试信息.我在Ubuntu 12.04.1上使用内核3.2.0-32.
有没有人有Linux的故障注入经验?
我想知道是否吸引这两个标记<并且>足以阻止XSS注射?
如果没有,为什么?什么是最好的解决方案?
有没有办法以编程方式将两个exe文件合并为一个,以便运行它将同时执行两个较旧的exe文件.我在google上发现了一些关于注入代码或dll文件的东西但是有可能两个合并两个exe文件或者将exe注入exe吗?
提前致谢.
[编辑] 谢谢大家.只是对于那些说不可能的人,我不得不说我最近按照一些建议的方式做了.它几乎就是这样(我不记得所有这一切,因为很久以前):
[当心:此算法与某些蠕虫和病毒的算法非常相似.我不是黑客或病毒作家!并且这仅用于实验或无害的原因 - 在代码中出错会破坏目录中的可执行文件.
1- Exe检查自身的大小以检测是否有任何附加到自身的内容.如果还没有:
1.1- The exe finds other executable files in its directory (lets call one of them as victim!)
1.2- it makes a copy of itself (lets call it newMe)
1.3- it copies the other executable found in the directory to the end of newMe.
1.4- it deletes the other executable file found and renames newMe to its victim's name.
Run Code Online (Sandbox Code Playgroud)
2-如果exe检测到已添加某些内容,则:
2.1- Then it copies data from itself (from ORIGINAL_FILE_SIZE to the end …Run Code Online (Sandbox Code Playgroud) 在我的一个班级中有一个public static String成员,我需要在中设置这个值 applicationContext.xml!也就是说,我们可以为这个静态属性注入一个值吗?
我们尝试用Guice重构一个项目.我们的想法是将所有语言界面绑定到一个像法语或波兰语这样的混合对象.
我们有一个绑定模块:
public class StandardModule extends AbstractModule {
@Override
protected void configure() {
bind(Language.class).to(Polish.class);
}
}
Run Code Online (Sandbox Code Playgroud)
以及使用此注入对象的classe(AboutDialog.java):
@Inject Language language;
public AboutDialog(JFrame parent) {
super(parent, "", true);
this.language=language;
this.setTitle(language.getLanguageInUse().getString("AboutDialog.title"));
this.parent = parent;
try {
jbInit();
} catch (Exception e) {
e.printStackTrace();
}
pack();
}
Run Code Online (Sandbox Code Playgroud)
我们有结果:
java.lang.NullPointerException at net.sf.jmoney.gui.AboutDialog.<init>(AboutDialog.java:67)
Run Code Online (Sandbox Code Playgroud)
第67行是:
this.setTitle(language.getLanguageInUse().getString("AboutDialog.title"));
Run Code Online (Sandbox Code Playgroud)
我们的界面是:
public interface Language {
public ResourceBundle getLanguageInUse();
}
Run Code Online (Sandbox Code Playgroud)
波兰语课程是:
public class Polish implements Language {
private ResourceBundle languageInUse;
public Polish() {
languageInUse = …Run Code Online (Sandbox Code Playgroud) 我正在尝试Greeter在Wildfly 8.2内部运行的EJB上注入给定类型()的对象.但是,部署始终会失败并显示消息
Unsatisfied dependencies for type Greeter with qualifiers @Default
Run Code Online (Sandbox Code Playgroud)
我试图用注释GreeterImpl和注入点注释,@Default但这也没有用.我在这里错过了什么吗?
我的Greeter界面:
public interface Greeter {
public void sayHi();
}
Run Code Online (Sandbox Code Playgroud)
我的GreeterImpl班级(唯一实施的班级Greeter):
public class GreeterImpl implements Greeter {
private static final Logger LOGGER = LoggerFactory.getLogger(GreeterImpl.class);
@Override
public void sayHi() {
LOGGER.info("Hi!");
}
}
Run Code Online (Sandbox Code Playgroud)
我的ScheduledGreeterEJB:
@Stateless
public class ScheduledGreeter {
@Inject
private Greeter greeter;
@Schedule(second = "*/15", minute = "*", hour = "*")
public void sayHi() {
greeter.sayHi(); …Run Code Online (Sandbox Code Playgroud) 我目前正在编写自己的MVC框架用于学习目的,我决定使用依赖注入容器来共享类之间的常用对象(例如数据库实例).
我在我的bootstrap文件中初始化了容器,我在我的Application类中有一个实例,在路由过程中传递容器实例是一个好习惯吗?(即将容器对象作为ControllerBase构造函数中的参数传递).另外,接受容器作为我的构造函数中的参数是一种好习惯ModelBase吗?
我知道你可以使用apktool反编译代码并重新编译它,但我的问题是你如何能够将大量代码注入apk并执行它.
我看到亚马逊的appstore drm正在做这个我假设,因为他们说他们用他们自己的代码包装apk,一旦你反编译那个apk你就会看到他们已经添加了自己的类com.amazon等.
他们如何实现这一目标?
code-injection ×10
php ×3
java ×2
android ×1
apk ×1
cdi ×1
containers ×1
debugging ×1
dependencies ×1
exe ×1
fault ×1
guice ×1
java-ee ×1
linux ×1
linux-kernel ×1
merge ×1
properties ×1
spring ×1
sql ×1
static ×1
xss ×1