information leakage._information interview

information leakage._information interviewhttps://www.owasp.org/index.php/Information_LeakageExamplesExample1Thefollowingcodeprintsthepathenvironmentvariabletothestandarderrorstream: char*path=getenv(“PATH”); …

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

https://www.owasp.org/index.php/Information_Leakage

Examples

Example 1

The following code prints the path environment variable to the standard error stream:

	char* path = getenv("PATH");
	... 
	sprintf(stderr, "cannot find exe on path %s\n", path);

Example 2

The following code prints an exception to the standard error stream:

	try {
		...
	} catch (Exception e) {
		e.printStackTrace();
	}

Depending upon the system configuration, this information can be dumped to a console, written to a log file, or exposed to a remote user. In some cases the error message tells the attacker precisely what sort of an attack the system will be vulnerable to. For example, a database error message can reveal that the application is vulnerable to a SQL injection attack. Other error messages can reveal more oblique clues about the system. In the example above, the search path could imply information about the type of operating system, the applications installed on the system, and the amount of care that the administrators have put into configuring the program.

Accidental leaking of sensitive information through data queries

When trying to keep information confidential, an attacker can often infer some of the information by using statistics.

Consequences

  • Confidentiality: Sensitive information may possibly be disclosed through data queries accidentally.

Exposure period

  • Design: Proper mechanisms for preventing this kind of problem generally need to be identified at the design level.

Avoidance and mitigation

This is a complex topic. See the book Translucent Databases for a good discussion of best practices.

In situations where data should not be tied to individual users, but a large number of users should be able to make queries that “scrub” the identity of users, it may be possible to get information about a user – e.g., by specifying search terms that are known to be unique to that user.

Accidental leaking of sensitive information through error messages

Server messages need to be parsed before being passed on to the user.

Consequences

  • Confidentiality: Often this will either reveal sensitive information which may be used for a later attack or reveal private information stored in the server.

Exposure period

  • Implementation: This flaw is a simple logic issue, introduced entirely at implementation time.
  • Build: It is important to adequately set read privileges and otherwise operationally protect the log.

Platform

  • Languages: Any; it is especially prevalent, however, when dealing with SQL or languages which throw errors.
  • Operating platforms: Any

Avoidance and mitigation

  • Implementation: Any error should be parsed for dangerous revelations.
  • Build: Debugging information should not make its way into a production release.

Discussion

Once an attack has failed, the first thing an attacker may use to stage the next attack is the error information provided by the server.

SQL Injection attacks generally probe the server for information in order to stage a successful attack.

Example: In Java:

try {
  /.../
} catch (Exception e) {
  System.out.println(e);
}

Here you are passing much more data than is needed.

Another example is passing SQL exceptions to a WebUser without filtering.

Accidental leaking of sensitive information through sent data

The accidental leaking of sensitive information through sent data refers to the transmission of data which is either sensitive in and of itself, or useful in the further exploitation of the system through standard data channels.

Consequences

  • Confidentiality: Data leakage results in the compromise of data confidentiality.

Exposure period

  • Requirements specification: Information output may be specified in the requirements documentation.
  • Implementation: The final decision as to what data is sent is made at implementation time.

Avoidance and mitigation

  • Requirements specification: Specify data output such that no sensitive data is sent.
  • Implementation: Ensure that any possibly sensitive data specified in the requirements is verified with designers to ensure that it is either a calculated risk or mitigated elsewhere.

Accidental data leakage occurs in several places and can essentially be defined as unnecessary data leakage. Any information that is not necessary to the functionality should be removed in order to lower both the overhead and the possibility of security sensitive data being sent.

The following is an actual MySQL error statement:

Warning: mysql_pconnect(): 
Access denied for user: 'root@localhost' (Using password: N1nj4) in /usr/local/www/wi-data/includes/database.inc on line 4

Missing Catch Block

If a Servlet fails to catch all exceptions, it may reveal debugging information that will help an adversary form a plan of attack.

When a Servlet throws an exception, the default error response the Servlet container sends back to the user typically includes debugging information. This information is of great value to an attacker. For example, a stack trace might show the attacker a malformed SQL query string, the type of database being used, and the version of the application container. This information enables the attacker to target known vulnerabilities in these components.

Example 1

In the following method a DNS lookup failure will cause the Servlet to throw an exception.

	protected void doPost (HttpServletRequest req,                 
						HttpServletResponse res)
				  throws IOException {
		String ip = req.getRemoteAddr();
		InetAddress addr = InetAddress.getByName(ip);
		...
		out.println("hello " + addr.getHostName());
	}

Example 2

The following method will throw a NullPointerException if the parameter “name” is not part of the request.

	protected void doPost (HttpServletRequest req,                 
						HttpServletResponse res)
				  throws IOException {
		String name = getParameter("name");
		...
		out.println("hello " + name.trim());
	}

A good error handling mechanism always tries to capture all exceptions and returns a generic error message that does not reveal any details about the error and the application. Depending on the platform and container the application is running on, there can be different options.

  • Set a generic custom error page for all unhandled exceptions at the container level. (Normally, this is set in the configuration file.) The generic custom error page should have a simple error message that does not reveal any details about the exception happened.
    • In ASP.NET, it is the customError tag in the web.config file
  • Use an global error handler to capture all unhandled exceptions.
    • In ASP.NET, it is the Application_Error sub in the global.asax file.
  • Handle the error in the page level
    • In ASP.NET, it is the Page_Error sub on the aspx page or associated codebehind page

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/192258.html原文链接:https://javaforall.net

(0)
上一篇 2026年1月16日 上午9:15
下一篇 2026年1月16日 上午9:43


相关推荐

  • 通过windows自带程序【任务计划程序】实现任务自启

    通过windows自带程序【任务计划程序】实现任务自启第一步 创建基本任务第二步 设置触发器第三步 启动程序 gt 选中对应 exe 文件第五步 点击完成即可

    2026年3月16日
    1
  • 关于大数据平台,这有一套完整的方法论,你确定不收藏?[通俗易懂]

    关于大数据平台,这有一套完整的方法论,你确定不收藏?[通俗易懂]大数据时代这个词被提出已有10年了吧,越来越多的企业已经完成了大数据平台的搭建。随着移动互联网和物联网的爆发,大数据价值在越来越多的场景中被挖掘,随着大家都在使用欧冠大数据,大数据平台的搭建门槛也越来越低。借助开源的力量,任何有基础研发能力的组织完全可以搭建自己的大数据平台。但是对于没有了解过大数据平台、数据仓库、数据挖掘概念的同学可能还是无法顺利完成搭建,因为你会发现太多的东西,和架构,你不知道如何去选择。今天给大家分享下大数据平台是怎么玩的。架构总览通常大数据平台的架构如上,从.

    2022年6月3日
    34
  • c# 连接ACCESS 数据库 OleDbCommand OleDbDataReader

    c# 连接ACCESS 数据库 OleDbCommand OleDbDataReader privatevoidbutton1_Click(objectsender,EventArgse)    {     OleDbConnectionconn=newOleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=fruit.mdb");      OleDbComma…

    2022年5月19日
    37
  • 阿里的笔试题_阿里巴巴java笔试题

    阿里的笔试题_阿里巴巴java笔试题2015阿里笔试题阿里2015招聘实习生笔试题笔试最后一题,题目大意是:给定一数组,数组中每个元素代表一个宽度为1的墙,求由这些墙能装多少水,输入为[1,0,2,1,0,1,3,2,1,2,1],输出为6.时间复杂度为O(n),空间复杂度为O(1).#includeusingnamespacestd;intVolume(intA[],intn){i

    2025年10月10日
    5
  • 14个简单有用的android源码,适合初学者

    1:查看是否有存储卡插入String status=Environment.getExternalStorageState();if(status.equals(Enviroment.MEDIA_MOUNTED)){ ;//说明有SD卡插入}2:让某个Activity透明在OnCreate 中不设Layout,然后this.setTheme(R.style.Th

    2022年3月9日
    44
  • linux系统安装pycharm教程_如何在linux下运行程序

    linux系统安装pycharm教程_如何在linux下运行程序方法一:步骤:进入pycharm安装路径下的bin目录下,输入如下命令:./pycharm.sh方法二:设置桌面快捷方式:参考博客:http://blog.csdn.net/tmosk/article/details/72852330(ubuntu下pycharm快捷方式创建)…

    2022年8月28日
    5

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号