Some time back I posted a paper at SANS on the topic of analysing and reversing packed malware.
The paper was focused on reversing NsPack (a common packer) in particular. If I have enough interest, I was thinking of creating a free video lecture series covering the technical aspects of reversing malware.
This will cover debugger use, ASM on Intel, packing and inline analysis of code and even how to inject your own controls into malware and change its behavior.
So, let me know if you are interested.
Saturday, 17 September 2011
Some time back I posted a paper at SANS on the topic of analysing and reversing packed malware.
Many issues in security come from a combination of a lack of care and
awareness. Even a lack of care can be seen as a consequence of a lack of
If we take the issue of the TDSS botnet mining Bitcoins, many users see this as little more than an inconvenience. They do have issues with lost system performance as their CPU cycles to 100%, but the theft through the botnet’s mining of the coins is seen as somebody else’s problem.
Fraud impacts us all.
It is not simply some nebulous company out there and a nameless victim, we all suffer when criminals prosper.
Organizations are becoming increasing dependent on their information systems in order to function effectively. Therefore, the availability of their information systems, the integrity of their data and the confidentiality of corporate information are becoming critical. Even a loss to a criminal group of CPU cycles and bandwidth matters.
In most organizations, the education required and the need for good security controls and procedures have fallen way behind. Users of information systems often see security processes as punitive and unnecessary. Developers see controls as restrictive and counterproductive in their efforts to develop and introduce systems.
User awareness of security-related issues is becoming an essential component of an effective security program. In the nineteen seventies and eighties, centralized administration did not require as much training and communication for the end user community. Security issues were mostly addressed by MIS and security personnel. From the nineties on however, with the proliferation of client/server applications and decentralized data, it has become increasingly more important that a good and effective security awareness program be part of an overall security implementation.
Security awareness training is required to emphasis the need for security and effective controls in the development and use of information systems. Users of these systems must be educated in the positive benefits of information security and the fact that security measures can actually save time and money by reducing the numbers of errors and accidents which form the bulk of threats to information systems. The additional benefit of security awareness training is the introduction of the 'ethos' of good practice and will flow on into other areas of your organization. A greater understanding of information systems, how to use them and how to gain access to them will reduce the overhead on support services.
For any information security awareness and training program to be successful, detailed planning is essential. The planning of awareness and training programs must consider the whole life cycle from the beginning of the process to completion. The following seven steps as developed in the NIST CSAT program may serve as a starting pointing the development of the program:
- The programs Scope, Goals, and Objectives need to be identified;
- The program trainers need to be selected;
- Target audiences within the organization need to be selected;
- Motivational goals for all members of the organization are defined;
- The program is implemented;
- A routine of regular maintenance will keep a program up to date
- Periodic evaluations need to be done on the program to maintain IT relevance.
- Establishing the organizational culture (and the associated risk environment);
- Identifying the organization’s risks;
- Analysing the risks as identified;
- Assessing or evaluating the risks;
- Treating or managing the risks (using cost / benefit frameworks);
- Monitoring and reviewing the risks and the risk environment; and
- Continuously communicating and consulting with key parties.
- Awareness levels are inadequately raised during either induction activities or subsequent awareness sessions;
- Policies and procedures are not being updated;
- Information security training fails to provide staff with an adequate level of skills to handle the security needs of the organization
- Awareness sessions are not adequately focused on the policies procedures and standards of the organization;
- Senior management do not support the awareness and training regime adequately
- Awareness or training activities are not maintained and kept current.
- Internal politics reduce the effectiveness of the program.
To achieve this is necessary to:
- Determine the necessary competencies within the organization,
- Provide awareness sessions and training for staff,
- Evaluate the effectiveness of awareness and training sessions on a regular basis,
- Maintain sufficient training records on the experience skills and qualification of staff to enable the recognition and analysis of weaknesses within the organization.
Management needs to facilitate awareness, training and education strategies with their organization. Good awareness processes and management support will help in the overall security of an organization as:
- An organization’s personnel cannot be held responsible for their actions unless it can be demonstrated that they were aware of the policy prior to any enforcement attempts,
- Education helps mitigate corporate and personal liability, avoidance concerning breaches of criminal and civil law, statutory, regulatory or contractual obligations, and any security requirement,
- Awareness training raises the effectiveness of security protection and controls; it helps reduce fraud and abuse of the computing infrastructure and increases the return on investment of the organization’s spending on both information security as well as in computing infrastructure in general.
 NIST Computer Security Awareness and Training (CSAT)
An Introduction to Computer Security: The NIST Handbook (Special Publication 800-12)
This text has been taken, rewritten and modified from some other books and writings of my own.
Friday, 16 September 2011
Grep becomes a truly powerful forensic search tool when matched with Regular Expressions (RegEx).
In this lecture segment, we show a few key examples as to how GREP and
RegEx can be used to search raw image files for Email addresses, Credit
Card numbers, IP addresses and URLs and far more.
Wednesday, 14 September 2011
The UK differs from the United States with its efforts at codification
through the Restatement and Uniform Trade Secrets Act to introduce a legislative set
of controls preventing electronic espionage. The English law as it relates to a
breach of confidential information is exclusively derived from the common law as
it has evolved through the cases. A duty of confidence arises when confidential
information comes to the knowledge of an individual in circumstances where it
would be unfair were that information to be divulged to another. This could be a
result of the receiver of the information being on notice, or having an
agreement, that the information was to be so handled. A breach of confidence is
the contravention of a duty which can result in a civil action. Breach of confidence will
regularly occur in association with the disclosure of data with a commercial
value. It can also comprise of personal information regarding individuals.
Breach of confidence is complex. It enlarges to “reflect changes in society, technology and business practice”. Furthermore, Art. 8 of the European Convention on Human Rights (concerning the right to privacy) have expanded the available actions connected with a breach of confidence to include safeguarding against the misuse of private information. Under English law, it is required the plaintiff proves three things in order to succeed in an action for a breach of confidence:
- the information must be confidential, but does not apply to information which is trivial;
- the information was provided in circumstances importing an obligation of confidence;
- there must be an unauthorized use or disclosure of the information, and, at least, the risk of damage.
The duty that confidence should be preserved may be outweighed by a variety of other civic causes. These call for disclosure in the public interest. Either the world at large or the appropriate authorities should be informed. It is generally necessary for a court to seek equilibrium for the protection of the public interest. This balance is judged in placing confidentiality against a use or disclosure that favors society and creates quantifiable gains. Disclosure of confidential information will not be reserved where there is a ‘just cause or excuse for disclosing it’.
An ISP or ICP needs to consider both the public interest as well as the need to protect client data. Failing to safeguard the interests and data of their clients increases the risk to the intermediary. This risk comes from damages in civil actions if the intermediary is found liable. This issue is a particular concern for ICPs (who have some obligation unless explicitly excluded in contract) and particularly service providers specializing in the provision of security services. These providers are contracted to ensure that the security of their clients is maintained and are open to actions in both contract and negligence if they fail in their duties.
The appropriate law of a contract is the system of domestic law that defines the obligations assumed by the parties to the contract. International law does not thoroughly define the requirement needed in a contract. The status is clearest where the parties have explicitly chosen the law that will apply in the contract. The parties may expressly choose the body of law, which will apply to all or part of their contract including offer and acceptance.
The UK requires that the parties must expressly choose to include the Hague Uniform law (Art.3, s.1 (3) Uniform Laws on International Sales Act 1967) [ULIS] in the contract terms before it applies to the sale of goods. This can if included have an impact on the process of offer and acceptance. Where there is knowledge of the residence or place of business of the contracting parties who each exist in a different state, several results arise in the case of a web site operation (for instance). Either “the contract concerns the sale of goods which are to be carried from one state to another or the acts constituting offer and acceptance have been effected in different states or the goods are to be delivered to a state other than that where the acts constituting offer and acceptance have been effected” .
Complications may occur if parties reside in a different state from where they hold their e-mail (Hyde v Wrench 1840) or other accounts. Treitel also notes that the communication of acceptance determines the time and place at which the contract is created. The general rule is that a contract is formed at the time and place that the acceptance is received, unless accepted by post, in which case the contract is formed at the time and place of postal of the acceptance. In cases such as this, the location the e-mail is accessed becomes an issue and the time at which the acceptance is made are both critical points. The place where the user accesses their e-mail may affect the acceptance. In many jurisdictions, the time and place of receipt of a message derives from when it is available to the recipient (Art.1335 Italian Civil Code; US: Restatement 2d of Contracts, S 56; Germany: case RGZ 144, 292). In the case of e-mail, the time it is available to the recipient is when it arrives on the client’s mail server. In this way, the timing and even validity of an offer and acceptance to a contract may come into dispute and may even come into effect in two or more places (Apple Corps Limited v Apple Computer, Inc. ).
One of the greatest difficulties arises as an ISP or content hosting operator will clearly not be in a contractual relationship with the owner of the confidential information. The equitable doctrine, imposing an obligation of confidentiality in respect of information which the recipient knows or ought to have known to be confidential, and further which was proffered under circumstances implying confidentiality may be appropriate in selected circumstances. Nevertheless, it is clear that there remains a substantial dilemma for the plaintiff in proving that such an obligation exists. This would be predominantly true where an ISP or ICP declares unawareness of what content was on the site.
 The Restatement and Uniform Trade Secrets Act (1985) USA. “In view of the substantial number of patents that are invalidated by the courts, many businesses now elect to protect commercially valuable information through reliance upon the state law of trade secret protection. Kewanee Oil Co. v. Bicron Corp., 416 U.S. 470 (1974), which establishes that neither the Patent Clause of the United States Constitution nor the federal patent laws pre-empt state trade secret protection for patentable or unpatentable information, may well have increased the extent of this reliance”.
 Lord Nicholls in Campbell v MGN Ltd  A.C.457 at 464-5 summarized the law of confidence as “[the imposition] of a duty of confidence whenever a person receives information he knows or ought to know is fairly and reasonably to be regarded as confidential”
 Douglas v Hello! Ltd  QB 967, per Keene LJ.
 Campbell v MGN Ltd  A.C.457
 Faccenda Chicken Ltd v Fowler  Ch. 117
 Coco –v- AN Clark (Engineers) Ltd.  RPC 41; Murray –v- Yorkshire Fund Managers Ltd  1 WLR 951. See generally Clerk & Lindsell on Torts, 19th edition (2006), Chapter 28, paragraphs 28-01 and 28-02
 The formation of electronic contracts subsists as a subset of all contractual formation. By their very nature and as it is expressed in a large number of contractual disputes which occur every year without dispute as to the content of the contract, contracts are uncertain. Thus it must logically follow that there will always remain a level of uncertainty in electronic contract formation. At best, if all uncertainty associated with the electronic nature of a contract was removed leaving no dispute between the natures of formation whether written, verbal or electronic; there remains room for uncertainty.
 Attorney General v Observer Ltd. and Others (on appeal from Attorney General v Guardian Newspapers (No.2))  1 AC 109, see especially pages 281 B-H and 282 A-F, per Lord Goff of Chieveley. See: Clerk and Lindsell on Torts, 19th Edition (2006), Chapter 28, paragraph 28-05
 Malone v Metropolitan Police Commissioner  2 WLR 700 at 716, per Sir Robert Megarry V-C and see also W v Edgell  Ch. 389; and R v Crozier  Crim LR 138, CA.
 Schu, Reinhard “Consumer Protection and Private International Law in Internet Contracts” International Journal of Law and Information Technology (1997) 5 Int J L & IT 192. (1997)
Posted by Craig Wright at Wednesday, September 14, 2011
Monday, 12 September 2011
The following is a small excerpt from an article I have written for Hackin9. It is part 1 of 2 and comes out on the
22nd of Sept 2011.
Not all security people are programmers and consequently we need to start by defining what a format string is. Any format string is basically a set of special parameters that define how to display a variable number of arguments when sending a string of data to stdout.
Format strings are primarily known in the C family of languages are used by Perl, PHP, and even many web scripting languages to determine how the rebels will be displayed. In the C programming language, it is necessary to define variables such that they are stored as a specific data type. These include integer values (int), character values (char) in many other forms of input. In programming with C and C++ format strings are primarily utilized by the printf() function family.
An example of a format string would occur if we wish to store the price of an item for sale from a catalogue. If we wish to return that value as a floating-point integer between $0 and $999.99 in value with the minimum width of three characters that always has two integer values returned after the decimal point we could do this by using the format string "3f.2f".
I pick on this book a lot, but “Teach Yourself C in 21 days” by SAMS, has so many good examples of how not to code that I cannot go past it. The authors particularly ignore both buffer overflow attacks as well as format string vulnerabilities. In Figure 1, we see that this book is a table of the common conversion specifiers. I recommend this book to all aspiring security professionals, it provides excellent training material for bug hunters and reverse engineers to uncover and practice exploiting.
In C code, format string vulnerabilities are devilishly simple to overlook. An example is displayed in the code snippet listed below. For the most part, the code will function correctly as long as we do not input unexpected data.
1: strcpy(buff, argv) /*Previously defined array “char buff”*/
2: printf(“\nHere we have typed our format identifier: %s\n”, buffer);
3: printf(“Opps, we forgot to add a format identifier here”);
In Code Segment 1, the vulnerability occurs at line 4. Ideally, we should have placed a conversion specifier in line 4 just as we see in line 2. Line 4 could be better written as:
Forgetting those few simple characters makes all the difference.
 printf refers to print formatted in the printf() family of functions commonly used and taught within the C programming language family.
Posted by Craig Wright at Monday, September 12, 2011