What tests can be performed on mobile apps to determine if they are secure? My company is looking to work with a potential client's backend provider in order to make an app for them. To do this, we need to use their API. We've spoken to this company and they are worried about security and so have said that they will only let us launch the app if we have it penetration tested by a third party.

The app will allow users to login and access their financial information so it makes sense that they want to make sure everything is secure but, from my understanding, "penetration testing" doesn't really make sense for a mobile app. Is this correct? What can we do to satisfy them that the app is secure? Is there a name for a kind of standard app security test that could be performed by a third party?

Speaking as a former security consultant who regularly performed penetration tests of third-party mobile apps, it absolutely makes sense. In practice, mobile apps are a bit less amenable to black-box pentesting than some other types of app (such as web apps or kernel-mode drivers), but there's a lot you can do even black-box (and more with white-box, though reverse-engineering most Android apps is so easy they are practically always white-box).

A few common security issues we found:

Apps not doing TLS validation correctly (for example, allowing self-signed certs or even arbitrary invalid certs).
Apps that had vulnerable entry points (file associations, URI schemes, share contracts, or other ways to programmatically invoke them and then make them do something they shouldn't).
Apps that used out-of-date libraries or SDKs with known vulnerabilities.
Apps that used web views with insecure JavaScript bridges.
Apps that used HTTP instead of HTTPS sometimes.
Apps that used web views but didn't lock down their paths or JS execution, and were vulnerable to web app vulns and/or to phishing.
Apps that stored secrets (credentials, tokens, private data, etc.) in plain text and/or in readable locations.
Apps that stored keys or other secrets (for example, an API key for a web service) in their binaries, as though an attacker can't reverse engineer the app to find it.
Apps that used native code insecurely, and had memory corruption bugs.
Apps that used cryptography incorrectly and therefore insecurely.

There are plenty more that can crop up, though those are some of the most common and/or severe. Mobile apps are definitely capable of having security bugs, and should be subjected to security reviews including penetration testing.


Problem understanding salting I'm a beginner in Information Security and am learning about salting. Unfortunately, most of the time I have to learn by myself since the lecturer doesn't provide deep explanation on these. I now have to solve some problems related to this and having trouble understand how salting slow down the attack

An access control system requires users to choose a password on an alphabet of size 96 (without special characters in ASCII). If we want users to remember a password of length 4, but remain the security level of the system as if we are using a password of length 7, how many salt bits should be used?

My attempt: I know that if we use a salt bit string of length k, the attack speed will be slown down for 2^k times since the number of possible passwords to test increases 2^k times. I thought the number of salt bit we need to use is 3, but the answer is ceil(3*log96). Why is that?
I'll be very appreciative if somebody can give a clear explanation about this.

but remain the security level of the system as if we are using a
password of length 7

Each character can have 96 different possibilities, and the it should be as if we are using a password 7 characters long.  So, this is 96^7 different possibilities, which is 7.5144748e+13 possibilities.  To convert this to base2, we take the log(base 2) of the above number, which gives us 2 ^ 46.09.  So, a password of 7 characters in length, where each character can have 96 different possibilities, has an entropy of 46 bits.

If we want users to remember a password of length 4,

Applying the same logic above, this is 84934656 different possibilities, or 2^26.33 possibilities, or an entropy of 26 bits.
So, the salt has to increase the entropy by 20 bits (from 26 bits to 46 bits).  This is equivalent to the answer that you posted.  You could have arrived at the same answer in a more direct way, by converting everything to bits from the beginning and using rules of mathematics that apply to logs, but hopefully doing this way is more illustrative.


Is this type of network possible in home environment? So in general I am a home user who is Tech Savy and played a lot with home networking equipment and want to completely secure my network and make it tight and harder to hack than standard home network even though when user done something stupid or got tricked for example to install malware or a reverse shell which for example could have been executed from a PDF file or Microsoft Office Suite like Word etc.

I have recently saw this type of a corporate network and think it is very secure:

(VLAN's with Private IP -> 10.0.X.X) ---> (Proxy/Different Servers) --> <--- (Internet)

It will be hard to explain as the network is kind of complex but here it goes:

The computers in such network have shared network resources which are File Shares as well as printers available to use and each computer have a private local IP address but can't touch each other and it's not possible or more like hard to even infect it. However, when the website is pinged, it only receives a DNS address back through hopping a different internal addresses (10.0.X.X) which I presume are the different machines in the local network setup with DNS Server and NAT to access outside world (?) but packets itself don't reach internet directly from a computer which tried to pinged a website.

Now, when such computer with a local IP address and no internet access at all wants to access outside world, it goes through Proxy/Server which caches content for all the local computers and passes it back to them. Now when the Reverse Shell or in fact any type of virus/malware which needs to call home is executed it cannot spread across the network or even connect back to the C&C server (Command and Control Server) as there is no internet on such computers except the Proxy/Server which caches web content and pushes it back to a local network.

Is it possible to setup similar type of network in home environment or should I just let it go as it might be a bit complex ? I mean, I'm always happy to learn something new.

Also I heard about ClearOS and asked them the same question but it seems that this type of network is not possible to set it up in this software.

You can implement such type of setup by using squid as proxy server inside your network, and give it access to the internet on your home router and deny all other computers from the internet access.

But such setup will depend on which type of home router you have, your home router should have some kind of firewall configuration or you will use Linux box as a gateway with IPtables.

I want to add also that such configuration will mitigate the risk of some remote access threats only and many advanced threats are smart enough to pass such scenarios.


Why doesn't Advanced IP Scanner show machine name? I am using Advanced IP scanner to view all the machines at my home. However, it just shows me only one machine but not the other. However, I am able to ping to the other machine. The network discovery for that machine is also on. Can anyone point out what the problem may be?

If you are talking about Windows Network Discovery, that would not affect the ability of a host to be detected in a ping scan. Are you doing a ping scan or does Advanced IP Scanner have options for other types of scans (e.g., specific ports on UDP or TCP).

If the one machine it returns is your own IP, you may have a local firewall issue blocking the scan or maybe a UAC thing. It's also possible that the other hosts on your network are blocking the scan with some host based intrusion detection/prevention mechanism. Have you tried using another tool such as nmap (if you want a GUI you can use zenmap).


Why do APIs use API Keys instead of Usernames? It is now common to use an API Key to identify an agent when dealing with an API. What are the merits of doing that over using a username specified by the developer? Is it simply that the API Key is harder to guess, or is there a deeper reason?

I can think of a number of reasons you might use a key:

Prevent guessing, especially if the key doubles as part of the authentication. This is what Terry's answer is trying to tell you - why allow a malicious user to simply try multiple user names from a dictionary when you can make them search a large address space (it would need to be be pretty big, bigger than 128-bit at least). Combined with rate-limiting and IP blocking, you would filter out a large number of attacks.
Prevent the users' account being compromised if the user name is public. If my username is antony and my API key is antony, great, you're half way to breaking in. However, if my API key is something random, it becomes much harder (see point 1).
Allow multiple devices to access the system and by extension enable a kind of access-control for devices. If you have one memorable username as your API key, this becomes hard to revoke unless there is a corresponding API secret. If you're using API secrets, having per-device secrets achieves a similar thing.
Prevent a leaked key from identifying the user in any way. This is, of course, entirely useless if the content of the application or device identifies the user.

This list is probably not exhaustive.


Why are PDFs less secure than other document formats? My email client will flag up PDFs as potentially insecure, but won't do the same for other document formats such as PPTs. Why is this?

Well, that's really a question for the makers of your email client to answer, but in general if software blocks every file attachment of a particular type then it is for one of four reasons:

The file is directly executable, and so might have a virus in it
The file is indirectly executable - e.g. a Word document might contain Macros that execute when you open it
the file is encrypted and so you can't tell what it is or scan it for viruses
the file type is one whose reader application has a lot of known exploits

PDF probably falls into the latter category: Microsoft report that almost all of the document exploits they see are PDF files infected with Win32/Pdfjsc.

(This in the very interesting SIR volume 11)


What's the difference between SSH tunneling and login into the same SSH server and executing commands? Consider these 2 scenarios.

(1)
Let's say I login into an SSH server named A normally using

ssh [username] @ [IP address of A].

And now I connected to another server named B which is accepting telnet connections using

telnet [IP address of B]

from that SSH session.

(2)
And I set up a tunnel using SSH from my machine to B using
ssh -L 9000:[IP address of B]:23 [username]@[IP address of A].

And I opened another terminal and executed telnet localhost 9000.

Is there any difference between these two? In particular, can someone explain what happens under the hood in these 2 scenarios? (I mean how the packets travel from source to destination and whether they are encrypted or not)

From a security perspective (and only this is relevant here):

In both cases the connection between the local client and A is encrypted (via SSH).
In both cases the connection between A and B is not encrypted (plain telnet).
Additionally the second case opens a listener on port 9000 on localhost which allows every local user on this machine to connect to B (via the SSH tunnel to A) without further authentication at A.


Getting spam calls from numbers similar to my own My phone number is 456-123-XXXX (American phone number + area code).  Over the past few months I get fairly regular spam calls from other numbers also beginning with 456-123-XXXX, where the last four digits are always different.  The calls are clearly spam, telling me I won a trip and then asking for my credit card number.  After getting one such call, I ignored it and called the number back.  The guy that answered seemed genuinely confused and said he hadn't called me.  I warned him that his number was likely being used for spam.  I've already called my carrier, but the operator who answered seemed totally confused and basically just suggested I change my number, which I really don't want to do.  My number is attached to a cell phone, although when I originally got it 15 years ago it was a landline.

So... what do I do?  Also, I'm curious as to what's actually happening... as well as if my number is also being used to spam other people.

The telephone system has been designed so that a caller can replace their phone number with a fake, and some unscrupulous companies use this to change their number to appear to be local to the person they are calling. They aren't using specific numbers of people you know, just something picked at random. The thinking is that a person is more likely to pick up if they think it's a local call.

It is illegal to spoof your number with intent to defraud in the US and Canada, so what they are doing is probably against the law. You could report this to the phone company and they may look into it. Other than that you can't do much about this unless your phone company offers an add-on service to prevent it.


Is Linux spying on its users? If you install some kind of Linux distributions on your computer, is their a possibility that their owners  may spy on you?

For example, can Ubuntu, Kali or Arch linux send data to its owners on what you are doing? Speaking about Kali, I guess it would be interesting for NSA or any other corporation to know why do you need it and what are you doing with it... It is just the matter of security for them...

Any time you execute code acquired from someone that you haven't fully reviewed and it runs on an Internet connected system, there is a risk that the person who wrote or deployed that code could transmit data about your usage to another system.  That's true regardless of the OS. So yes it's possible.

The question then becomes "has this happened in the past", and "is it likely to happen in the future".  The only case that springs to mind where people may have been sending data form a linux distro to 3rd parties inadvertently was the ubuntu linux Shopping Lens which could be regarded as spyware and was by some.

Outside of that, I'm not aware of any instances of large-scale spying from the mentioned linux distros. As you say pentest distros like kali are obviously an inviting target, but then their users are more likely to notice an indiscriminate transmission of data from their systems.

Ultimately it comes down to trust.  By executing code belonging to someone else you are trusting them (think of trust in this context as "the power to betray") with any data you enter into that system.

How you establish trust in a system is a really good question and one which, as far as I can see, is far from answered.


OpenSSL Base64 output has wrong length I try to generate an ECDH P-256 key pair as required for web push messages.

openssl ecparam -name prime256v1 -genkey -noout -out priv_key.pem

... generates the keys.

openssl ec -noout -text -in priv_key.pem

... looks good: As expected, the private key has 33 bytes, the public key 65. When I export the public key:

openssl ec -in priv_key.pem -pubout -out pub_key.pem

... I expect the base64 output to be 88 characters long - but what I get is 126. The server doesn't accept this key. I read about compressed base64 (https://security.stackexchange.com/a/146515/173609) but this doesn't solve the problem either (it results in an 80 byte base64 string). Anyway I fail to understand how OpenSSL generates this base64 output.

You don't get the raw bits of only the key when exporting it using openssl ec -pubout but a structure with more information:

$ openssl asn1parse -in pub_key.pem -dump
    0:d=0  hl=2 l=  89 cons: SEQUENCE
    2:d=1  hl=2 l=  19 cons: SEQUENCE
    4:d=2  hl=2 l=   7 prim: OBJECT            :id-ecPublicKey
   13:d=2  hl=2 l=   8 prim: OBJECT            :prime256v1
   23:d=1  hl=2 l=  66 prim: BIT STRING
      0000 - 00 04 11 5e 44 51 b0 95-4e 9b 14 42 e7 60 21 10   ...^DQ..N..B.`!.
      0010 - f0 05 5d b4 bb 76 22 6d-2e 45 66 ad 3a 89 eb f2   ..]..v"m.Ef.:...
      0020 - 15 00 57 89 29 98 ce 84-5e b2 58 83 fb 8d 7a 59   ..W.)...^.X...zY
      0030 - 6d 11 2e 5d c3 7c e1 df-4a c9 ce a6 94 89 61 2a   m..].|..J.....a*
      0040 - dc 06

Thus, you get essentially 91 binary octets which translates to 124 characters when encoded as base64.


Why do salts for hashing passwords need to be globally unique, not just system/site-unique? I was reading an answer by Terry Chia to another question about the requirements for a salt, in which he/she (among others) specified that salts need to be globally unique, but don't go into any detail on why.  This was defined as "not only unique in the context of your database, but unique in the context of every single database out there".  For example, I have been using an email address as a salt for my experiment-y sandbox website/database.  These could certainly be being used as salts on other websites.

It doesn't make sense to me because, as I understand it, the purpose of the salt is to ensure that "cracking multiple compromised password hashes together should be no easier than cracking each one of them separately" (Ilmari Karonen, further down on the same post).  Unless I'm mistaken, this constraint is satisfied as long as my salts are unique within my database.

I am further confused because generating globally unique salts sounds impossible for me to control.  How am I supposed to be able to guarantee that none of my salts have ever been used on someone else's site, with the millions of sites out there?  To be fair, I haven't looked into how to generate random salts yet; maybe the idea is that they are created from a large enough pool that even considering the number of sites out there, duplicate salts generated for separate databases is very unlikely?

I am definitely biased towards using an email address as my salt, since it's one less small step of work, but given the number of people who seem to disagree with this approach, I recognize that I am probably wrong.  And besides, I want to know more about why I'm wrong because it doesn't make sense yet.

The goal of salting is resistance to precomputation.

While you can't guarantee that a salt is globally unique, you can (just as you said) generate salts of sufficient size as to make it infeasible to generate a rainbow table in advance (making them "unique enough").

More generally, if you're asking about how to create a salt, it sounds like you're rolling your own hashing method, which may be educational but is not generally recommended.

Instead, use an existing hash (such as PBDKF2 or bcrypt) (or even better, as CBHacking rightly suggests in the comments, scrypt or Argon2). Not only will you automatically inherit their existing salting methods (which are quite sufficient), but your experimentation will be aligned with password storage best practices ... which would probably be better practice.

Update 2018-04-03: Steve Thomas (sc00bz) makes a good point here that Argon2 and scrypt are actually worse for the defender when used at speeds generally considered to be compatible with authentication at scale (<0.1 seconds), while being better for the defender for speeds compatible with encryption of individual files (1 to 5 seconds). (This means that the gap from 0.1 seconds to 1 second is probably interesting, and bears testing for your specific environment). In other words, his assertion is that if you try to tune Argon2 or scrypt to <0.1s speeds, the results are less resistant to cracking than bcrypt is at those speeds.

In the same thread, Aaron Toponce also makes a great suggestion for working around bcrypt's length (72 characters max) and pre-hashing limitations, by using bcrypt(base64(sha-256(password))). (See also Thomas Pornin's similar answer here). The reason that the base64 is needed is also interesting - don't leave it out.

So if your use case is scaleable, cracking-resistant authentication with a fast authentication experience, bcrypt(base64(sha-256(password))) is probably a good approach. (And you'll need to adjust bcrypt's work factor to the highest value that fits within your authentication speed window). If your users can tolerate waiting a second or more to authenticate, Argon2i or scrypt may be better. And note that relative performance will shift over time, as hardware capabilities improve - so increasing the bcrypt work factor every X months for new hashes (as Dropbox does) would allow the approach to adapt to future capabilities over time.

Update 2019-09-01 It turns out that wrapping a faster hash in a slower hash without salting/peppering that faster hash first is dangerous, because fast uncracked unsalted hashes from another source (such as another leak) can be tested in bulk against the wrapped hashes without having to crack those faster hashes first. The faster hashes can then be attacked in a separate job at a much higher rate. So my advice above should be updated to  bcrypt(base64(sha256(password.salt))).


Firefox pre-downloading I've found out that if you download a file with Firefox, a similar window as this one pops up (in dutch in my case):

("Bestand opslaan" = "Save file")

However, the file is already being downloaded before I press the Ok button (i.e. I waited 1 minute before clicking on the Ok button and already 50Mb of 191Mb was downloaded).

Does this feature come with any security risks (a malicious file could be downloaded before I even had the chance to click Cancel) and should I find a way to disable it or is this perfectly safe?

Technically, the popup does not ask you whether you really want to download the file; that decision, you already took when you clicked on the link which triggered the download. The popup asks you what Firefox should do with the file when it has been fully downloaded.

Potentially hostile files can be a security issue. Filesystems normally store files as bunch of bytes and are thus nominally immune to the file contents; but modern operating systems are not content with handling files as files. For instance, if you open a file explorer to see the directory in which downloaded files are stored, and the file has a name which ends in '.jpg' or '.png', then the file explorer will try to interpret the file contents automatically, as a picture, so as to compute and display a miniature view of the said picture. Any security hole in the JPEG or PNG support library could then be exploited by a malicious file, and it does not require any "opening click" on the file, just opening the directory.

The Web is a harsh place.


General concerns with cookies and privacy The following post is in regards to headless *nix machines only...

I know programs like wget allow options to control cookies. However if a program is not HTTP centric, has little or no options for controlling HTTP, though still makes HTTP requests...
Am I in some way subject to cookie storage then?
If not why? and if so how?

What are all other, if any, methods that servers use to track clients, regardless of the protocol being used?

Cookie management is the responsibility of the application. When it doesn't support cookies, it won't store any and it won't deliver any. When it does support cookies, it will usually use its own private cookie storage and not share the cookies with other applications. But there is no guarantee that it does not. Refer to the documentation of your programs for details.

The most simple way to track clients regardless of their protocol is of course their IP address. IP addresses are not very reliable because many users can share IP addresses through NAT and when the machine uses a consumer-grade internet connection with DHCP, the IP can change at any time. Servers in proper datacenters, however, often have static IP addresses with a DNS entry, making them easy to trace by their IP address.


Microsoft password strength checker I typed in my password in Microsoft password strength checker website. Could it now be possible for someone to recover that password from my computer?

From your computer - Not any more than usual, no.

However the owner of the website you used could very easily have a copy of your password!

You shouldn't ever use an online password checker, as you have no control over where your data has gone.

As Neal stated in this answer on a very similar question:

  You're unnecessarily exposing your password to some site out there on
  the internet! Even local applications for password checking may be
  nefarious. Claims that the site uses javascript and never transmits
  the password over the Internet cannot be trusted. Some password
  strength testing sites are surely run by black hats, who just add them
  to their dictionaries along with whatever other information they can
  gather about you.


Are the sticks of RAM in my desktop computer volatile? Is it safe to sell them? I have two sticks of RAM in my computer that I would like to sell or donate. From what I understand some RAM is volatile, losing all its contents when power is gone for a few minutes, and some is non-volatile, retaining that information after power is lost. I would like to know which kind of RAM I have and whether it is safe to give it to someone else.
I am not very tech savvy, all I know about the sticks is that the manufacturer is Kingston, and when I open Task Manager it says that it is "DDR3" and the form factor is "DIMM".

Yes, they're safe. Consumer memory DIMMs use volatile SDRAM memory. Volatile means that it does not hold its state after you turn it off.
SDRAM memory chips are constructed from an array of memory cells, with one cell per bit of data stored. Modern memory ICs have billions of cells each. Each memory cell is constructed from a transistor and a capacitor. A transistor is like an electronic switch, and a capacitor is like a tiny battery. The value stored in the cell is a single bit - a value of 0 or 1, represented by a low or high voltage.
Here's a circuit diagram of a simple memory cell:

You can simulate this circuit in your browser here, and I'll talk you through how it works. You can control the simulation with the "Run/STOP" and "Reset" buttons on the top right. If the run/stop button is red, you've stopped the simulation. If it's grey, it's running.
I've labelled the transistor and the capacitor, so you can see where they are. The parts marked 10k, 100k, and 1M are resistors - don't worry about those for now.
At the top left of the circuit we've got our input data. This is a switch that selects either 5V or 0V (ground), to represent a value of 1 or 0. We use this switch to select which value we want to write into the cell. On the right, we've got our output data. This will show as 1 or 0 when we read from the cell.
Underneath that, we have a write/read switch. This selects which operation we want to perform. When switched to the left it writes a value to the cell, using whichever value was set by the input data switch. When switched to the right it reads a value from the cell and displays it on the output data.
The enable switch allows us to decide whether or not we want to talk to this specific cell at any point in time. When there are many of these cells all connected to the same input and output signals, this allows us to select just one cell to be read from or written to.
There's another switch marked "leakage". I'll get to that later - leave that switch open for now.
First, let's write a 1 to the cell. Set the input data switch to 1 and the write/read switch to write. Then close the enable switch. You'll see the bottom of the circuit light up green, and little yellow dots will move for a moment to indicate that a current is flowing as the capacitor charges up.

The top part of the capacitor goes green, indicating that the capacitor is now charged up and the cell's value is set to 1.
Next, flip the write/read switch to the right, in order to read from the cell. The output data now shows 1.

Repeat this again, but for an input value of 0.
Also have a play with the enable switch - you'll see that when it is open, the output data will always be 0 regardless of what you do with the input value and the write/read switch. Additionally, whatever value is stored in the capacitor stays there until you turn the enable switch back on.
What we've looked at so far is an ideal memory cell. It can store a 0 or 1 almost perpetually. However, in reality there is always some leakage in the capacitor that causes it to slowly lose its charge. You can simulate this with the leakage switch I included in the circuit.
Close the leakage switch, then set the input data to 1, the write/read switch to write, and close the enable switch. This will cause a 1 to be written to the cell. Now change the write/read switch to read, and look at the output data. It will show 1, just as before. Now wait a few seconds. The output data will flip back to 0.

If you watch the path through the leakage switch and the 10k resistor, you'll see the current dots flowing slowly along as the capacitor charge leaks out. Eventually, the capacitor voltage drops below the threshold voltage, causing it to be read as a 0 instead of a 1.
Try this a few times to get a feel for what's happening. Once you're happy with that, it's time for another experiment.
With the leakage switch closed, repeat the write process again and store a 1 in the cell. This time, instead of immediately performing a read operation, open the enable switch beforehand. Wait a few seconds, then close the enable switch. Here's the full steps in case it's not clear:

Close the leakage switch.
Set the input data to 1.
Set the write/read switch to write.
Close the enable switch. Observe the capacitor charging up.
Open the enable switch.
Set the write/read switch to read.
Wait 5 seconds.
Close the enable switch.

Notice that the output data is zero! What happened is that the charge in the capacitor leaked away while you were waiting, causing it to drop from 1 to 0.
This happens in real DRAM chips, too. The controller on the memory chip has to constantly refresh the data in the cells by reading them and writing their values back, to keep up with leakage. When you turn off your computer the data in the DRAM memory chips quickly degrades and leaks back to all zeroes. This process normally takes only a few seconds.
(interesting little aside here: the time it takes to set up the switches and get the data in and out of a specific cell is what defines the latency of memory, often listed as four numbers or just something like "CL16" - the memory timings wiki has some further info on this)
The leakage process can be artificially slowed down by cooling the chips down to very low temperatures, in what's known as a cold boot attack. This causes the cells to retain their values for much longer. It only works if you freeze the RAM right at the same time as powering the system off - if you wait even a few seconds before freezing it all the data will have begun to degrade. As such it's not a problem for you.

There are some additional interesting things that can be talked about here, such as SPD flash, NVDIMM, and Intel Optane, but I'm due to play a D&D game in ten minutes so I don't have time to expand this answer right now. I'll come back later and edit them in. Don't worry, though - they don't affect the safety of your sale!

Ok, zombie beholder's dead. Let's talk non-volatile RAM.
There's a special type of memory technology called NVDIMM. An NVDIMM is like a regular DDR SDRAM module, except it has a battery backup on it and a non-volatile flash memory chip. This allows the system to be powered off without losing memory state. The battery backup on the DIMM allows it to continue to refresh the memory cells. It then copies the contents of the memory cells into the non-volatile flash chip. It can then safely power off, because the contents of memory are saved and the volatile memory chips do not need to be refreshed. The operating system has to be built with support for this feature. This is a specialist memory technology usually reserved for server applications where you need to be able to recover the contents of memory during a power outage, or bring the system up to the same state quickly after maintenance (e.g. replacing a PSU or UPS).
Another type of non-volatile DIMM is Intel Optane. This is actually not RAM at all - it's better to think of it like a very low latency NVMe SSD that just happens to plug into a DIMM slot.
Finally, let's talk about SPD flash. When you plug a DIMM into your system, your motherboard needs to be able to identify it and learn about its specs and features - its name, size, type, speed, latencies, voltage requirements, inbuilt overclocking profiles, and all sorts of other details. This information is provided by a standard interface called Serial Presence Detect (SPD). In practice, the information is stored in a table (the exact format and contents of which is defined by JEDEC) in a small non-volatile flash EEPROM chip on the DIMM, which the motherboard can talk to via SMBus. The operating system can also talk to this chip to find out information about the memory - you can view it with a tool like CPU-Z.
Normally this SPD data is written to the EEPROM at the factory and never changed. However, it is entirely possible to write to the flash chip from the operating system. Some chips do technically have the ability to lock the first half of the data (usually the first 256 bytes) but often this is not done, and the second half of the data is always writable. The size of the SPD table for DDR4 is 383 bytes. However, nobody makes 383 byte EEPROM chips - that'd be weird. Instead, you'll usually find that the chip is 512 bytes in size. This means that there are 129 bytes left in the EEPROM that aren't used for anything. If you wanted to, you could store 129 bytes of non-volatile data in every stick of RAM in your computer, by writing to the SPD flash. I wouldn't recommend trying this yourself, since there's every chance you could brick your RAM if you do it wrong, but I did this as an on-stage demo at a security conference a while back.
The SPD interface isn't usually exposed to anything but the kernel, but there are many signed Windows drivers out there that either provide write access to SPD by design, as well as drivers that provide write access to SPD by accident, which you can abuse to write a small amount of data to the SPD flash chips.
There is, therefore, a scenario in which an attacker could use one of these drivers to write to the SPD flash. This data would remain on the DIMMs even after the system rebooted, or even if you re-installed your OS. The data doesn't do anything by itself - you need malicious code to already be running on the system to actually read and write it - but it is a nice little hidden storage location for a few bytes of data. There's almost no reason to abuse this storage location in practice - it's complicated, error-prone, requires admin and a loaded driver, for almost no benefit in return - but it is a fun little trick to store non-volatile data on regular volatile memory DIMMs!
One scenario where this is actually really important is bare-metal cloud hosting environments. In these environments, customers rent physical systems that they have complete administrative access to, rather than virtualised instances. Providers of these services need to ensure that there is no data remanence between one customer and the next. The SPD writing trick is one way for an attacker to achieve data remanence. There are plenty of other EEPROMs on the motherboard, hard disks, network card, RAID card, etc. that can also potentially be written to by an attacker with that kind of access. Bare-metal cloud providers have to implement special checks to ensure that these non-volatile flash memory devices were not modified. It's quite a challenge and hardware attestation is far from a solved problem. Again, this doesn't affect your consumer memory DIMMs, but it's a situation where a device that you expect to be volatile or stateless may actually have some non-volatile state.


How to find name of file to include in local file inclusion attack? In a local file inclusion attack, besides guessing, is there method that allows an attacker to know the name of the right file? The name of the file to be included in a LFI attack is not always something well known such as these:

/etc/passwd
/etc/shadow
.htaccess
.htpasswd
../admin/.htpasswd
/proc/self/environ

Sometimes the name of the file to include is very hard to guess and unpredictable. Hence, I am asking if there is a technical method to know the right name of the file that can save us the time of guessing.

No, there's no other way to know if the file exists or not.

However, if you can find out what OS is running on the system, then often you will be able to find the right path to certain files quite easily.

In rare cases websites have a script or page which iterates through files in a folder specified by a POST or GET parameter which you could manipulate to display all files in a specific folder. I haven't seen this vulnerability in a while though.


How can I protect my data/privacy against rule 41 Other than air-gapping, does anyone know enough about rule 41 to provide advice and guidance on how to protect a linux system from this type of remote hacking? I've read that perhaps linux + disk encryption + firejail with Tor could possibly be a good defense. I've also read that booting and running from a liveCD would be the only way to prevent such access to your system.

http://fossforce.com/2016/05/rule-41-getting-around-constitution/
http://fortune.com/2016/11/30/rule-41/

This answer covers only the recent changes to Rule 41, which I assume from your links is what you are asking about. It also assumes you and/or your equipment is in the US; if you're a non-citizen and you and your equipment are outside the US, the 4th Amendment rights that are clarified by Rule 41 wouldn't apply to you anyway

The changes primarily affect the (geographic) scope of what law enforcement is legally allowed to search with a warrant. So it's worth pointing out that you're asking for information on how to prevent agents of the government from legally obtaining information from your system that they have been explicitly (via a warrant) been given permission to have.

From a technical perspective, there's no difference between

a) what law enforcement from within your jurisdiction is allowed to do (and has been allowed to do) regardless of Rule 41 changes,
b) what law enforcement from a different jurisdiction is now allowed to do under Rule 41, and
c) what criminals can do outside the law to hack your computer.

So from a technical perspective, this question is just, "how do I secure my computer from access by people who were not personally authorized by me to access it," and the Rule 41 part of your question is irrelevant.

Finally, it's probably worth noting that the changes to Rule 41 include allowing a judge from outside your jurisdiction to issue a warrant if "the district where the media or information is located has been concealed through technological means," so using Tor would actually bring you into the scope of the Rule 41 changes; if you don't hack (damage) someone else's computer and don't try to hide your location then you are not affected by the changes to Rule 41.


Storing credentials for desktop app I have desktop application written in C# with three user roles and some predefined users. It is also possible to create another users or change passwords to predefined users. App has to work offline on Windows XP and newer.
What is the best way to work with user credentials on local machine if I have to have some predefined users? I thought that Data Protection API (DPAPI) is the best way how to handle this, but if I understood it well, it only works for one Windows users, so it is useless for me, because I have to ship predefined users with app installation and it is definitely not the best idea to hold those predefined users in source code (even if I save them with DPAPI to disk after installation).

Do you need to test the credentials or really store it ?

If all you want is check whether the user knows a given credentials, then use a secure password key derivation function (for instance, PKBDF2, BCrypt or SCrypt) instead.

If you really need to store the credentials (for instance, you need to forward it to an external service), then the answer is that you need to rethink your model:

If you're providing pre-filled passwords for a remote service (for instance, you want all your users to share a specific account on a mail server), then that means you're using hard-coded passwords and that is really bad: you cannot possibly secure it and obtaining these passwords, even if you obfuscate then, is usually very easy for an attacker to obtain it. And once one attacker has obtained that password, he can leak it for everyone else to use.
If your pre-filled password are actually just initial values that are supposed to be changed later, then leave them blank and force the user to change them during the installation.


What should I do when I found a strange email on my phone? Today I found a strange email (not sent, just a draft) on my Android smartphone, and this is not good. The screen was on standby and when I pressed the on/off button to see the clock, I found a draft email. Now I've changed the password of my Gmail account and I've disabled internet on my smartphone.

What should I do, control, clean, etc. to secure my android smartphone?

In the recipient field I found:

Gmail addresses similar to ilii8888iiiiiliiiili@gmail.com
a double quote "
iiiiiii8i

time:

20 / 07 / 2015 18:30 (my phone was on my room at this time and nobody touched it)

initial body:

liiiiiii
Kiss"iKiiiiiii"""""K""KiiiiKiiiiiiii
KiiiKiiiiiiiii"KiiiiiiiiKKKiss"
KissKiiiiiiiiiiii"KiiiKiiiKissKiiiii""Kiiiiiiiiii""
io"kiss"keiko
KiiKiiiiiiiilii""Kii"kiiii"ioK
""

middle body:

Kii
"
"kiiiiiiiiii
"""Ioiiii
"KKii"Kii
""K
Milioni
"""Poi
""
""
K
I
Missionario
"Kiiiii8

end body:

|
|

""
"

K
"""""
""
;
"|

""
"

""
*

Go to the google account security page and check what devices has accessed your account recently. Then change your password and remove the device. You should probably enable two step authentication and look over your app passwords too.

You should probably wipe/reflash your phone if there is a chance that it contains bad software with root privileges.


Why would a modern browser allow internal resources to be loaded from an external page Recently someone announced that several Arris surfboard models lacked any form of authentication to perform functions such as reboot and factory reset a modem with a single http call.

Read more on that here if you want: https://blog.wjd.io/motorola-surfboard-hack

My question is why would a modern browser allow internal resources to be loaded from an external page. What viable use cases are there that would outweigh the obvious security implications of this issue?

functions such as reboot and factory reset ... why would a modern browser allow internal resources to be loaded from an external page

Most of today's routers and other networked devices will be administrated through a web interface. This means that there is some web server with a web application running on the device and the user is using the browser to access this device the same with as (s)he is using any other web page. This web interface then offers ways for the user to reboot the system or similar by clicking the specific links in the web interface.

But by default a browser allows lots of interactions between web pages of different origin. You can click on a link on one web page to go to another page. Or you can embed images from one page into another page etc. The browser itself has no knowledge what is an internal page and what is an external page and which pages are allowed to link/embed to another and which not. Thus the web applications have to do the checks by themselves, i.e. check if a request to the device is caused from a different origin and don't execute it in this case.

Thus the one which was overly permissive in this specific case was not the browser, but the web application running at the router. It should have checked the origin of the request and not execute it if it was caused by some other site (cross origin request).

Unfortunately this kind of bugs are very common. Such devices are often developed with a tight budget and security only adds costs but not functionality. Apart from that most developers are not even aware that the web is mostly permissive by design and that they should add the needed restrictions to the device.

Since such bugs are that common it would of course be nice if browsers would at least include some protection for such broken devices, like limiting access from external to internal sites. But unfortunately there are actual use cases for such cross-origin requests to local IP which then would break. And then are issues with DNS and proxies. And probably more issues. For a deeper discussion see this Chromium bug where they discuss about this issue since about 2 years.


How safe is the 256-bit encryption used in bank transactions? Most of the banks use a 128-bit or 256-bit encryption. What does this mean? Does it mean that the keys used in SSL are 128-bit long or what?

If they are the SSL key lengths then 128 bit RSA keys are easy to decrypt. The rsa site itself recommends keys having length of 1024 bits or more.

You can pretty much ignore the statements about 128 and 256 bits.  It is a marketing statement intended to sound impressive, but really it just means that they are using SSL in a not-totally-stupid way.

(It means the symmetric-key cipher is using a 128-bit or 256-bit key.  This ensures that the symmetric cipher is not the weakest link in the chain.  However since the symmetric cipher is not the weakest link in the chain, the risks will be primarily elsewhere, so you shouldn't get too caught up in the meaning of 128- or 256-bit strength.  This just means that they haven't chosen a stupid configuration that makes the symmetric key readily breakable.  It does not mean that the RSA key is 128 bits or 256 bits; as you say, a 128-bit or 256-bit RSA key would be totally insecure.)

There is a lot written about this topic on this site.  I suggest you read Is visiting HTTPS websites on a public hotspot secure?.  Also see the blog entry QotW #3: Does an established SSL connection mean a line is really secure?.
And read Is accessing bank account on the internet really secure? and Does an established ssl connection mean a line is really secure.  Doing a search on this site will find lots of information -- give it a try!


How to prevent MITM DNS attack by router My landlord is very much a busybody and he has extreme political views. I suspect he is using a Windows program that communicates with the Wifi router to record what websites all the tenants are visiting. I suspect this not just because of his personality but because (A) the Wifi router is insisting on being the DNS, and (B) when his Windows computer got ruined by the recent Windows 10 update bug, he was forced to change the two SSIDs of the Wifi router. Normally SSIDs never need to be changed because of what happens on any connected computer.

My simple workaround to the router wanting to be my DNS was always to use 1.1.1.1, 8.8.8.8 and 9.9.9.9 as my DNSes. However if his Wifi router has the ability to be a DNS MITM and it e.g. knows that these IPs are well-known DNSes, then it could still be recording all my DNS interactions. How can I prevent this?

If it's only DNS you're worried about, then just use DNS-over-TLS or DNS-over-HTTPS. However, if you're worried about this, then you should probably be worried about the rest of your traffic too, so I'd recommend you use a VPN.


Phishing domain converting text due to special character? Warning: The following links are phishing links, please do not sign in to them.

Today, a friend of mine came across the link hxxp://steạmcommunlty(dot)com/tradeoffer/new/. It's a phishing link, but I have no idea how it works. Notice the a in steam is a special character? When you go to that link and copy and paste it, it somehow converts to xn--stemcommunlty-kf2g(dot)com

How is it doing that? Is it something to do with the ạ converting into something else making it a completely different URL?

Browser is doing this to follow the standard regarding hostnames containing non-ASCII characters:

  Non-ASCII domain names ("IDNA") rely on a special transfer encoding
  ("Punycode") to allow non-ASCII domain values inside the ASCII-only
  DNS nameserver hierarchy. Punycode encodes a domain name such as
  "faß.de" using special markup that looks like so: "xn--fa-hia.de"

This is done for all domains containing such characters, and has nothing to do with domain being phishing.

PS. Your "steạmcommunlty" domain name also uses lowercase L instead of I in the word "community".


Enterprise HTTPS redirection without certificate error I have a captive portal setup for my organization that forces users to authentication prior to being allowed access to the network. Challenge is that when a user opens their browser and their homepage is https (e.g. https://google.com/) and I redirect their traffic to http://myportal.company.com the end-user receives an error.

As the web has defaulted more and more to HTTPS (which is good!) it is now causing me a problem.

What options do I have?

A captive portal is essentially doing a man in the middle attack. HTTPS and other protocols using SSL/TLS are explicitly to detect and prevent such man in the middle attacks. This leaves you with two choices: don't do a man in the middle attack or make the client trust the man in the middle. All fully transparent solutions require that you have some control of the client.

Trusting the man in the middle is in many cases possible if you can add the man in the middle CA of the captive portal as trusted to the client. In some systems like windows this can be done in an automated way (group policy). If browsers will see that the certificate is signed by this explicitly added CA they will also disable checking of public key pinning (explicit and builtin HPKP). But note that it will not work in all cases, i.e. there are non-browser applicatons like Dropbox which continue to do certificate pinning and thus will not work any longer.

Non doing a man in the middle attacks works if you configure the captive portal as an explicit proxy in the client. If proxy autoconfiguration is enabled in the client this can be done with a WPAD server, it can be configured with group policy or it have to be manually configured. With a proxy you could request authentication. But you are limited to either basic authentication (username and password) or to transparent authentication using NTLM. There is no way you could first present some information to the client which he has to accept. Proxy authentication also only works if the client knows that it is talking to a proxy. Simply intercepting normal HTTP/HTTPS traffic and sending back a proxy authentication request will not work. This also means that applications which are not aware of the proxy (i.e. don't use system settings) will not work.

And finally you could abandon any attempts to redirect the user and simply post information which describes that the clients should first authorize themselves using some internal URL. Until this is done any access simply fails and once the client has authorized himself the MAC of the specific client is allowed for a while.


Is it possible to DDos a http wan filterd router? Like the service is there but it's  just filterd  enabled for lan access only .. what will happen ?

Yes, it's possible to DDoS even if no ports are open.

Keep in mind that a DDoS attack works by exhausting a resource. It can be processing power, storage, memory, or bandwidth. So if an attacker sends way more traffic in your way than your network can receive, your network access will be severely degraded. No matter if there's a service active to receive the packets.

The most effective way to counter such attack is to work with your upstream ISP and tell them to drop every packet assumed to be part of an attack. That is not cheap or easy, but is how most internet services protect themselves.

The other way is to increase the network bandwidth to have more resources than the attacker, but this is more expensive than the former solution.


Which is better in "DH-group14-sha1 with hmac-sha2-256" and "DH-group-exchange-sha256 with hmac-sha2-256" from performance and security perspective? In our product (embedded system), so far we were using diffie-hellman-group1-sha1 with hmac-sha1. But due to security concern we are planning to use diffie-hellman-group14 for key exchange and hmac-sha2-256 for HMAC.

Is it ok to use diffie-hellman-group14-sha1 along with hmac-sha2-256.
Would diffie-hellman-group14-sha1 and hmac-sha2-256 combination be good from performance and security point of view?

Would there be much performance impact if we use diffie-hellman-group-exchange-sha256 and hmac-sha2-256 combination.

Since we are using embedded system so we want to maintain a fine balance between security and performance.

I would be very thankful if people can provide their views?

The unstated context of this question is an SSH server: these are negotiable cryptographic options in the SSH transport protocol. You may want to update the question to indicate this.

From the form of your question, I first want to clear up something. When you ask:

  Is it ok to use diffie-hellman-group14-sha1 along with hmac-sha2-256. Would diffie-hellman-group14-sha1 and hmac-sha2-256 combination be good from performance and security point of view?

... this appears to imply that you think there's something to be concerned about in the mere combination of these algorithms. There isn't; they are entirely independent. These:

diffie-hellman-group1-sha1
diffie-hellman-group14
diffie-hellman-group-exchange-sha256

... are key exchange algorithms. They are used early in the transport protocol to establish the session keys (encryption/MAC), authenticating the server in the process. These:

hmac-sha1
hmac-sha2-256

... are names of MAC algorithms used to implement integrity checking for user data subsequently transmitted by the protocol. These are used later, with keys derived from the output of the key exchange. If you're asking the question because you think there might be some issue in "mixing" SHA-1 and SHA-256 -- so far as I know, there is no reason to be concerned about that in this scenario.

  Would there be much performance impact if we use diffie-hellman-group-exchange-sha256 and hmac-sha2-256 combination.

Now you've introduced the "group exchange" version of the SSH Diffie-Hellman key exchange. This allows the server to use locally configured Diffie-Hellman parameters (finite groups), instead of the fixed groups prescribed by the "group1" and "group14" exchanges. The performance impact would be determined by the groups you provide, mostly by the size of the groups in question. You can reduce the overhead by using smaller groups, with a corresponding reduction in security. Keep in mind that the client requests a modulus by size, so you must provide groups large enough to satisfy your clients.

SSH Transport Protocol (http://tools.ietf.org/html/rfc4253)
SSH Diffie-Hellman Group Exchange (http://tools.ietf.org/html/rfc4419)


Best guidance for allowing users to connect via HTTP in case of a certificate error I've coded my app to use https, but if a https transaction fails for any reason, I assume it's because the server isn't configured for https, and thereafter start all transactions with http. Seems like that's a vulnerability. Likewise, a script kiddie using a proxy to intercept the traffic on his client hardware would be able to make all https transactions fail.
I'm told that if someone tries to MITM your app's HTTPS request then the request should fail (invalid certificate) and your app should fail with an error, not fallback to HTTP. In a world where SSL is reliably available, sure, but maintaining valid SSL certs is a task in itself. For example, letsencrypt recently revoked some of their certificates and forced renewal of same because of some security problem. Aside from revocations, certs are short term and have to be renewed, and the renewal process involves a lot of stitchware, and can fail. If SSL goes down, I don't want my site to go dark.
What is the best guidance for either:

More reliably maintaining certificates (such that if they do fail, the resulting downtime falls within the "five nines" SLA unavailability window) without it being such a manual headache, or

Allowing the site to continue to work if SSL has failed?  Is it easy to allow most activity to proceed using http, but allow known-critical transactions to require https.

Note that no browsers are involved in the scenarios that concern me.

I've coded my app to use https, but if a https transaction fails for
any reason, I assume it's because the server isn't configured for
https, and thereafter start all transactions with http. Seems like
that's a vulnerability. Likewise, a script kiddie using a proxy to
intercept the traffic on his client hardware would be able to make all
https transactions fail.

Well, do you control the server or not ? It either is configured for https, or it is not. SSL could fail, but it's more likely that you will encounter other issues like the httpd service crashing for some reason, or the server being overloaded. The result is the same: interruption of service.

I'm told that if someone tries to MITM your app's HTTPS request then
the request should fail (invalid certificate) and your app should fail
with an error, not fallback to HTTP. In a world where SSL is reliably
available, sure, but maintaining valid SSL certs is a task in itself.

You should automate the deployment and renewal of certificates. Automate as much as you can, always. If the task is boring, that's one more reason to automate it.
But also make sure that your script will send an alert if the process goes wrong. Since you mentioned Let's encrypt they do provide some scripts if I'm not wrong.
If you have only one server and want to do it manually, at a minimum add the renewal date to your agenda. Don't wait until the last minute to renew your certificate.
If you chose to use https then you should stick to it and not devise workarounds to defeat your own security measures. If service availability is important you can improve redundancy by adding more servers/endpoints to your network architecture. Then your app can try another server if the chosen one is unavailable.
Downgrading the transport layer is not a good move and there are many more problems that could occur, that are not related to SSL. Your effort should be focused on making the service more resilient.
Suggestion: log webserver errors such as SSL negotiation failures (very likely that your webserver software already does that), then make sure critical errors are reported to you asap. Set up a log collector or something. Logs are useless if nobody is paying attention.

Allowing the site to continue to work if SSL has failed? Is it easy to
allow most activity to proceed using http, but allow known-critical
transactions to require https.

You could, but you have to segregate 'sensitive' traffic from casual traffic. That probably means adding some application logic. I don't see much value in it for the reasons described above.


What is the proper setup procedure for SSL Tunnel certificates? I am a systems integrator using a system designed for bringing HVAC data up to a common interface; this system/software platform is called Niagara AX.  The combination of the customer's network setup and requirements for a project have brought together the following scenario:

All systems providing said data must communicate to the consumer of that data via a web browser with HTTPS
There is a centralized virtual server that must be the access point through which other systems are accessed, and sub-system access must be via HTTPS
The customer has provided a Microsoft Active Directory certificate authority and certificate signing tool
Certificates generated by the HVAC systems are signable by the customer's signing tool and are accepted by the HVAC systems and work correctly in web browsers for direct connections to all systems, including the central server and all sub-systems
The HVAC software platform provides built-in options only for HTTP tunneling and using HTTPS

I have managed to get my system working correctly on all points except where the sub-systems must be accessed through the centralized server.  Direct HTTPS access works correctly in all instances.  From what I can see, my only option given the customer's setup and requirements is to use HTTPS tunneling which uses a specialized syntax specific to this HVAC system (e.g., https://cent-server/tunnel/127.32.41.8/file/px/Floorplan.px).  At this point, any number of things usually happen, including 404s with silent redirect to a nonsense page, or "waiting for cent-server" that just eventually times out.

I have been told that the fix involves "combining" my SSL certificates into a single large certificate and having this "common" certificate in place on all systems involved.  My question is this:  how can I accomplish this?

Let my systems be labeled C - centralized server, A - sub-system A, B - sub-system B, R - root certifying authority (highly simplified).  Attempting to combine the signed certificate portions of certs A and B into the public + private PEM for cert C and then importing into the certificate manager in C results in an error CertPathValidatorException claiming "Intermediate certificate lacks BasicConstraints".  I'm not sure what other combination options I have available when putting my PEM together, although I know that it doesn't make sense to just insert the public-side of certs A and B into the section where this system expects cert-chain pieces to be.

According to tech support for Niagara AX, "HTTPS Tunneling is not supported".  This contradicts what I have heard from other sources, so while I will put this as the "official" answer to my question, I may update it if other information becomes available.

In other words, the point of my question, namely to find out whether certain settings or file formats for the HTTPS certificates were required to make this type of tunneling possible within this software/network environment, is moot.  Thank you to all who took the time to read and consider my question.


Are there general guidelines (or better yet, compliance standards) for assessing the risks of a cloud-based API? I'm studying for the CCSP exam and one part of the training material stuck out.

  It behooves the cloud customer to formalize a policy and process for
  vetting, selecting, and deploying only those APIs that can be
  validated in some fashion -- a method for determining the
  trustworthiness of the source and the software itself.  This process
  should be included in the organization's acquisition and development
  program, as well as the change management effort.

OK, that makes sense... sorta. The training material didn't go into any detail and stopped there.  It seems to me though that this process is subjective and that one cloud customer could consider an API totally safe while another cloud customer could consider an API awful.

So my questions are:

Are there broadly-accepted and documented industry standards or governing bodies that dictate the requirements for lower-risk and viable cloud-based APIs?
In the absence of that, are there at least general guidelines on what cloud customers should look for in an API? For example, I feel like this is something that OWASP would have but I didn't see this on their web site.

I'm not aware of any standard that would apply specifically to an API. I think the assessment of whether it's good enough will need to be driven by the purpose of the API. If the API is used to gather local date, time, weather information, etc. it will require very different security controls than one which retrieves credit card transactions or shares your own company's protected information (for whatever value of "protected" your company has defined).

In any event, there's not much magic to an API -- it is essentially an external programmatic connection to another service. The way you assess or secure that will be similar to the way you would do so with your own addition of code, library, or functionality that involves exchanging data with a third party.


Why clients offer handshaking with SSL 2.0 protocol According to the book, Data Center Fundamentals, page 369, SSLv3 support was added in Netscape 2.x and Internet Explorer 3.x, and TLS was added in Netscape 4.x and Internet Explorer 4.x.

I am listening router in my company(I have 200mb pcap file with just https connection) and these old clients does not exist in company computers but I observe some of the client hello requests are in SSLv2 format. So only reason a client send client hello in SSLv2 format seems compatibility with servers who does not support new versions of ssl . This compatibility issue stated in http://tools.ietf.org/html/rfc5246#appendix-E.2 .

I couldn't understand when client send "client hello" in v2 for compatibility . How client decides it should send v2 client hello or how it decides it should send v3.1 for example ?

A client sends a SSLv2 ClientHello when it is ready to use SSLv2, and it supposes that the server may be an SSLv2-only server. In practice, a given client will always send a SSLv2 ClientHello, or never: the client cannot know what a specific server supports until it has actually talked to it, so it is an all-or-nothing configuration option.

Modern browsers are of the "never" persuasion; some don't support SSLv2 at all (SSLv2 is officially deprecated; its support has been removed from OpenSSL, so Web server using Apache+OpenSSL will soon to support it). But older browser versions could use SSLv2, and some were sending SSLv2 ClientHello by default (I think IE 6.0 did that).

Note that a server can understand the SSLv2 ClientHello format and still not support SSLv2 (i.e. the server accepts the ClientHello only if it internally states that the client also knows SSL 3.0 or TLS).

Since the SSLv2 ClientHello format is incompatible with extensions such as Server Name Indication (there's no room for extensions in that format), and since it makes no sense for a client to send such a ClientHello unless it is ready to actually do a full connection in SSLv2, we can assume that the SSLv2 ClientHello feature will disappear in the future... but we are not there yet.


Safety of using web based proxy? Lets say for example I have to use a public online proxy like https://www.zend2.com
to load a PHP webpage controlled by me containing sensitive data over HTTPS.

How would I make sure that the proxy in the middle doesn't have insight in the data without modifying the client (browser), JavaScript and/or additional domain names and servers.

The solution's only goal is to prevent the public proxy attack layer (theoretical).

When you use a re-webber proxy (a website where you enter a URL and it shows you the content of that url in its own context), using TLS between you and the end-website becomes impossible, even when the proxy would want to provide it.

When you enter https://google.com in the proxy you linked, you get redirected to https://www.zend2.com/vip3.php?u=RyhEPtB1SQ6bFRGMjVSDaC2jhw%3D%3D&b=29. Note that the domain you connect to is https://www.zend2.com. That's the domain you make your TLS handshake with. Anything else would lead to a certificate warning, because your browser expects a valid certificate from www.zend2.com, not from google.com. The proxy then does its own TLS handshake with the destination site, requests the content, decrypts it, COULD look at it, re-encrpyts it for you and sends it to you.

You might also notice that this service performs a man-in-the-middle attack right before your eyes! It adds its own HTML code to each website you load through it, even when you load it through HTTPS. This code includes Javascript, which is executed in the context of the website you load. They could use this for all kinds of XSS attacks when they would want to. The website demostrated that they can and will manipulate any content you access through it, so you should not use it to send or access any confidential information.

To avoid this, do not use a rewebber service. Use a proxy server properly by entering it into the connection settings for your web browser. In that case your web browser is aware that it is using a proxy server and will expect a TLS certificate from the actual destination, not from the proxy. Any eavesdropping or manipulation by the proxy become impossible in that case.


How to become an internationally recognized certificate authority (CA)? What's the procedure a certificate authority (CA) must follow to get internationally recognized, like Verisign or GlobalSign?

To be intentionally recognized, the trusted certificate authorities (CAs) will need to get their root certificates pre-bundled with specific web browsers and operating systems (OS), like Microsoft Internet Explorer, Apple Safari, Mozilla Firefox, Google Chrome and Opera (et al.). The trusted root certificate list is usually updated periodically to add or remove certificates.

In addition, specific programs like Java or Adobe have their own trusted root CAs which is used in their applications (thanks paj28 for the reminder!). Adobe has a setting which allows all Windows root certificates to be trusted automatically. However, I think the process is not so straightforward in Java.

To be included in Microsoft's Root Certificate Program,

  The CA must provide the information requested below, and receive preliminary approval for membership in the Program.

Similarly, Apple's Root Certificate Program requires root certificate authorities to meet certain criteria. This goes on for other browsers.

Other web browsers/OS may have their own specific requirements and legal agreements. Hence, to be as recognized as "internationally" as possible, a CA usually needs to contact all the major OS and web browser developers to obtain permission to be included in each pre-installed list of trusted root CA certificates.


Generating a secure AES key? I asked this question a while ago about IVs in AES, and I got a very nice and helpful answer (thanks!) so I was thinking maybe you guys could help me out again, this time with the actual key generation.
TL;DR - See bottom
Currently, I'm encrypting like this:
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
SecureRandom randomSecure = SecureRandom.getInstance("SHA1PRNG");
byte[] iv = new byte[cipher.getBlockSize()];
randomSecure.nextBytes(iv);
IvParameterSpec ivParams = new IvParameterSpec(iv);
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivParams);
rawCryptotext = cipher.doFinal(textToEncrypt.getBytes());

So you can see, I am using the SecureRandom class to generate the random IV.
However:
Notice the key variable in the 6th line of code:

SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");

That variable comes from my getKey() method, which is as follows:
public static String getKey()
    {
        String possibleKey = "init";
        String validKey = null;

        while (possibleKey.length() != 16)
        {
            System.out.printf("\nPlease enter a 128-bit key: ");
            possibleKey = input.nextLine();
        }

        if (possibleKey.length() == 16)
        {
            validKey = possibleKey;
        }
        else
        {
            System.out.println("Something has gone very wrong...");
        }

        return validKey;
    }

You'll notice that I get the key from the user, and pass it in plain text to SecretKeySpec.
So my question: Does combining a plain-text key with a random IV make for secure encryption? Or should I hash the key string with SHA-256 or something first, and use the result for the key?

No

What you're doing, is asking the user to enter a 16-character string or, in other words, a password. It's true that 16 bytes can fit 128 bits, but that only holds for data where all possible byte values are (equally) possible. Text consisting of characters is all but that. First, because the set of printable of characters is much smaller than that of all bytes. (It's likely they won't even be able to enter all possible bytes if they tried.) Second, because user's aren't going to enter random bytes, but words. And words are even more predictable.

If you want the user to enter a password, don't limit the length (except maybe to set a minimum), and use something like PBKDF2 to stretch the key and slow down dictionary guesses against the password. (As @marstato commented).

On the other hand, if you want to generate a random key, pull bytes out a strong random bit generator, and save it in a file.


Testing Package Leakage at the Router I'm home learning a course/certificate for pen-testing and security analysis. I came into a part in the process of pen-testing Perimeter Devices, specifically at testing the Router.
At this point I'm advised to do a Testing for Package Leakage at the Router. A little explanation in that part stats that some router may disclose its identity while connecting on certain ports.
For example 'Cisco' in the payload with a 'RST' response after connecting on port 1999 (TCP).
Unfortunately, there is no more information about this part even after I did some search. So my questions are:

What is Package Leakage?
What exactly this step and how to try it for any Router?
How this is differs from OS Scan and Ports Scan?
What tools (if any) to use in this test?

Package Leakage is a general term for packets being sent somewhere where they should not be sent. There's no exact list of every possible scenarios, but as example -  packets with non-routable IP addresses that are only valid on the LAN being sent to the ISP is one concrete Package Leakage situation.

In such a case, to avoid packet leakage, you must enable a packet filtering functionality and specify that packets from the local network should not be sent outside the local network. NAT takes care of towards-outside special communications if needed.

Another example may be when you use VPN. You will want in such a case the VPN-protected content to go through the VPN and the rest of the general traffic through the normal connection. (Package Leakage like all default traffic through VPN may cause your VPN service to halt.)

The OS part is something else entirely. There, you will most likely get excessive CPU usage, which can cause you PC to run slow or freeze. Programs can cause it or abnormal network traffic can cause it.

Ports scans are completely unrelated to Package Leakage. Determining the status of open ports has nothing to do with Package Leakage, but it may help improve security of a device like a router.

AS for tools, you can use pretty much any network sniffing/monitoring tool like wireshark to determine if you have abnormal packets in your network traffic.


Is this a phishing email? I've just received the strangest email:

I don't understand why anyone would send an email like this. It doesn't look to be asking for credentials of any kind. Is this a scam which is designed for you to engage with the sender?

It is possibly an attempt at Bayesian Poisoning of your spam filter. Spam filters work by analysing words in the email and assigning them a spam value. One form of Bayesian Poisoning is to send an innocuous email that contains mostly "good" words and one or two "bad" words. The spam filter will see the message as not spam and over time it can be trained to assign these "bad" words a lower spam value - which will allow more spam though.

See also How does Bayesian poisoning work?


Correct way to get a number from 0-9 from a random byte? If I have a good random number generator that gives me a byte of data at a time, and I want to extract a random decimal digit of 0 to 9 from that byte stream, what is the correct way to do that?

At first I naively assumed that a simple (randomByte mod 10) calculation would be sufficient, but since 256 is not evenly divisible by 10, that results in a clear bias in the "random" digits:

0: 101323 #################################
1: 101261 #################################
2: 101473 #################################
3: 101389 #################################
4: 101551 #################################
5: 101587 #################################
6: 97831  ###############################
7: 97893  ###############################
8: 97843  ###############################
9: 97849  ###############################
(histogram from 1 million 'random' digits)

One method that appears to work is to discard any value above 249 and divide by 25. Is that cryptographically correct? Is there a better method that doesn't involve discarding (potentially expensive) bytes of randomness?

(this question is prompted by reading about a  CryptoCat vulnerability, where one of the discovered flaws was that they discarded random values above 250 instead of above 249, giving a slight bias in their "random" numbers... so I was curious what the "right" way to do it is)

There are two generic ways to produce a "sufficiently unbiased" random digit.

First method is to loop if the byte was not in the right range. I.e.:

Get next random byte b.
If b is in the 0..249 range, return b mod 10.
Loop.

This method may consume an unbounded number of random bytes, but it is perfectly unbiased and it is very unlikely to require looping many times. That's what Java's Random.nextInt(int) standard method applies (albeit with 32-bit words instead of bytes).

Second method is to use as source value not one byte but a big enough word. Say, use 20 bytes, interpret these as an integer x in the 0..2160-1 range, and return x mod 10. This way, the bias is still there, but can be made arbitrarily small, to the point that it no longer matters. This is computationally expensive (more than the first method) but has the advantage of always requiring the same number of input bytes, which can be handy in some specific situations (e.g. side-channel leaks).


How to bypass ASLR with ROP I was reading this article by the InfoSec institute:

http://resources.infosecinstitute.com/an-introduction-to-returned-oriented-programming-linux/#gref

And was able to follow along until he did the ROP Chain.

He finds the offset of printf and execve to be 328160

He then finds the following ROP gadgets:

0x804886eL: add eax [ebx-0xb8a0008] ; add esp 0x4 ; pop ebx
0x804861fL: call eax ; leave ;;
0x804849cL: pop eax ; pop ebx ; leave ;;

I understand that the idea is to load the absolute address of execve into eax and then call eax, but where i get lost is the way he does it.

The gadget:

0x804886eL: add eax [ebx-0xb8a0008] ; add esp 0x4 ; pop ebx

Adds eax and [ebx - 0xb8a0008] and then stores it in eax for the next gadget to call.

The goal now seems to be to get ebx to contain the absolute address of printf@got, but instead he loads 0x138e9ff4 into ebx, he says its because:

printf@got + 0xb8a0008 = 0x138e9ff4

I just have no idea how he calculates the value 0x138e9ff4, as ASLR is enabled and printf@got should be different every time, and therefore the value loaded into ebx should too.

Would appreciate any input you have

I agree it is very poorly explained in the article. It took me several reads to understand what on earth was going on.
The key part is here:

Our aim now is to build a chained ROP to execute execve(). As we can see, we don’t have a GOT entry for this function and libc is randomized.
So what we will do first is to leak a libc function address for GOT then we will do some trivial calculation to get the exact execve libc address.

They're making the assumption that you've got an information leak that tells you where any single libc function is. In this case, they're using printf as an example.
From there, the exploit makes way more sense:
The first step is that they populate eax with 0x328160 and ebx with 0x138e9ff4 using the pop; pop; leave gadget. When that add instruction is executed it computes 0x138e9ff4 - 0xb8a0008 = 0x8049fec. This is the address of printf@got in the example. Note that this is the address of the Global Offsets Table (GOT) entry for printf, not the actual printf function itself. The base address of the GOT is not randomised in regular Linux (it may be in grsec-hardened kernels; I haven't looked into it)
The instruction is now essentially: add eax, [0x8049fec]. The attacker knows that for the target version of libc the distance between printf and execve is 0x328160, so when this instruction runs it takes the address of the printf function from the GOT and adds 0x328160 to it (from eax, which was preloaded by the pop pop leave) which loads the address of execve into eax.
The call eax then executes execve.


How can I store a password history to prevent reuse? I have an application with a user database.  The database stores the password using a bcrypt hash with a randomized salt.

How can I implement a password history set (to prevent password reuse) in a case like this?

If I have the traditional 3 field password reset (enter current, enter new, confirm new) I could store the current one as I replace the old with the new. However, then I have the case of a forgotten password. My users could go and do an self-service auto reset and reuse their passwords over and over again.

The stored passwords would be encrypted, but with reversible encryption making them less secure.

Store the old salt and hash values.  Hash the new input with any old salts and see if they match.

If it worked for checking the password when they logged in normally, it will work for checking if the password has been used before too.


Cracking long Windows XP passwords Completing an assignment for my Ethical Hacking unit at University at the moment and the first task I have is to crack some passwords.

Decided to use backtrack to crack some passwords from a Windows XP box I set up.

I'm using bkhive and samdump2 to get the encryption key to unencrypted the SAM file and dump it into a text file.

I'm then using John the Ripper to crack the password hashes, this is working fine with "short passwords" but when I try it with long passwords of say 20 characters it just says that there is no password for that account.

Anyone got any idea what's going on?

EDIT: Just to make it clear, it doesn't even attempt to crack the password, it just says that the user has no password after about 10 second of the program running. I'm aware that it would take an awful long time to crack the password.

It thinks that it has cracked the password: have a look at this: http://aporcupine.com/john.png

For a password of that length, your only real options are to subvert it entirely, or try a different approach.

Rainbow tables aren't yet big enough to cope with that length, but because the majority of passwords in use are badly chosen
A dictionary attack may give you better odds of breaking it. You'd need to make some assumptions on words, alternate characters etc and will have no guarantee that your assumptions are correct.
Have a look at this question over on the Security Stack Exchange for some in depth discussion on passwords sparked by the famous xkcd cartoon.
Social engineering might be your best bet - however that probably doesn't come under the remit of an Ethical Hacking course at University.

You should definitely come on over to Security SE anyway, as it is likely to give you useful input which could help you on your course.


Wireless Exploit Project I've been given a task of doing research for some tools/methods of accomplishing the following goals:

The engineers will scan the 802.11-based signal cloud around your network testing for ways that outsiders could eavesdrop on your wireless communications, break authentication or cryptographic protocols, or impersonate elements of your wireless infrastructure.

Please note, I am new to the field of IT security in terms of practicing and researching exploits, so it would be the most helpful if you could be point me in the right direction i.e. links to good Youtube videos, reccomend books/blogs for this particular taksing, and particular tools to use.

Thanks in advance

For getting started, i recommend a fresh install of kali linux.

Wifi NIC emulation can be a pain if you intend to install Kali on a VM (One solution would be to emulate your Wireless NIC with a compatible Wifi USB adapter.)

So, dual boot (Kali seems to be now UEFI compatible) or a dedicated computer would be the best.

This linux distribution is embed with a large panel of well documented security related tools, including 30+ wireless programs.

As @SecretSasquatch mentioned in the comments, the AirCrack-ng suite would be a nice fit for getting started. I'm assuming you know how to read a .pcap file. If you dont, please practice with tcpdump or wireshark before doing the following:

The most simple attack would be to crack a wep key with vector(IVs) attacks
More difficult and quite luck dependent : WPA Cracking (I like to use both jack the ripper and Aircrack-ng when performing this.)
Bonus stage : EvilTwin attack

Studying and practicing those 3 attacks should cover a wireless security initiation.

EDIT : Maybe a bit more than an initiation actually.

Good luck.


odd ip address connected to my box Today i went to the library. I was looking at my netstat -an output and i saw this.

tcp        0      0 127.0.0.1:6379          127.0.0.1:46376         ESTABLISHED
tcp        0      0 127.0.0.1:46376         127.0.0.1:6379          ESTABLISHED
tcp        1      0 172.16.10.99:41582      123.123.123.123:80      CLOSE_WAIT
tcp        0      0 172.16.10.99:34960      172.217.2.238:443       TIME_WAIT
tcp        0      0 127.0.0.1:6379          127.0.0.1:43480         ESTABLISHED
tcp        0      0 127.0.0.1:43526         127.0.0.1:6379          ESTABLISHED

I noticed the 123.123.123.123 address which connected to me on port 41582. When i geolocated the IP the website said it belonged to a place in Beijing, China. Then i remembered that i haven't accepted the terms of use for the library internet connection i was using.

So this made me feel more odd about it. I am curious to know if this connection was being made from the internal library network or being proxied through the library which would mean that a device in the library was being used as a proxy?

Because 172.16.10.99 was my internal IP when i was at the library. The public IP of the library was something different.

I run Ubuntu Linux and when this occurred i was not browsing any websites in China or accessing anything in the Asian continent.

So this all seems a bit odd.

Just trying to make sense of this event.

Could anyone provide some insight?

My concern is that i have something on my box which is listening on these ports and it is being accessed when there is an active internet connection.

Here is what shodan mentions regarding this IP:
https://www.shodan.io/host/123.123.123.123

Thanks.

It's your laptop that was connecting (or trying to connect) to that IP, not the other way around. I tried connecting to that IP, and basically it won't connect.

Your netstat didn't really show an established connection either, since it's in CLOSE_WAIT. Googling that IP didn't bring up anything about possible related threats, but I found at least one discussion where that mysterious IP was explained as "likely misconfigured default setting". If you think about it, it is a very peculiar IP, 123.123.123.123, which might well be a string used as an example IP address, just like "abc123" for a password, or contact@domain.com for an email address. So there's nothing there, it's might just be a random default setting that makes no sense.

I have no idea where that misconfigured default IP could be set though: applications on your laptop, scripts or any assets in web pages, etc. If you run netstat with the -e and -p options you might be able to understand a bit more.


Can nmap take a list of ports to scan from a file? Nmap can take a file containing a list of hosts to scan using the -iL flag.
Is there similar functionality for a file containing a list of port numbers?
I've scoured the man page, online docs at nmap.org and Googled, but nothing as of yet.

Not by itself, no. But with some quick scripting you can.

For example, on *nix systems:

nmap -p `cat ports.list` ...

This would allow you to maintain a list of ports in a file in a CSV format.

If you would prefer to have one port per line, you can do this (thanks @bonsaiviking) on *nix systems:

nmap -p $(tr '\n' , <ports.list)


How can I ensure that Dropbox is using only its folder? I'm using several cloude storage services, like Dropbox. Each have windows app for its synchronization, and this app actually can read anything from my disc, not just files from its 'synchronized' folder. I want to make sure that this apps never access any other folder except sync folder. Is there a way to do so (using VM is not an option - too much resources required).

Create a new user.
Give that user access rights to only the folders you want to share. You can use the File and Folder Permission options on Windows, and simple chmod on Linux.
Run your application (Dropbox, for example) under that user. You can use runas on Windows, and sudo -u on Linux.

Please note that you might have to allow access to other folders where Dropbox keeps its cache files and configurations.


Is sqlmap scan detectable? I have a REST API running on a server.

Is there a way to detect an unexpected sqlmap analysis?

SQLMap works by sending a lot of different requests to the server. It is pretty easy to see the scan if you look at your server logs manually.

If you want to do it programatically, just look for SQL verbs in your logs in the input fields where they don't make sense (select, from, where, order by).


2FA Security on Setup When setting up 2FA with Authy most websites give you a QR code to scan.

Would it be correct to say that you should treat this QR code securely? If this code or a picture of it was leaked there is nothing to stop someone else setting up 2FA on another device without you knowing, is there?

You absolutely need to consider the QR code a secret.

For 2FA (i.e. TOTP), the QR code has a shared secret embedded, which is basically what makes TOTP work (see https://tools.ietf.org/html/rfc4226).

OTP (both HOTP and TOTP) basically rely on HMAC, and the shared secret is used as the HMAC key.

The difference between the two OTP types is pretty much what is getting HMAC'ed - for TOTP, a timestamp, and for HOTP, a counter.


Tracing nuisance or malicious cellphone calls Is it possible for an ordinary citizen to trace source of nuisance calls to cell phone when caller ID has been blocked?

The caller ID you get is what your provider tell you and in turn it's what the caller's provider claims. Even your service provider cannot trace the exact source of the call, it only knows what the caller's provider claims.

So you need the cooperation of your provider to give information about the call (mainly the caller's provider). Then you need the cooperation of the caller's provider and you give them your number and the time of call, then it could be possible for them to identify the caller.

The whole process is nearly impossible for the normal Joe to do. You need help from the authorities. Even then, don't really count on them. Depending on your jurisdiction, unless your caller is a "terrorist" or some high-profile criminal, they likely won't do anything.


What damage can a malicious .iso file cause without explicitly executing it? have a question about a downloaded "bad" file, i was redirected to a page from a link and, because i used chrome, it automatically downloaded a .iso file and saved it on the C drive in the downloads folder.

I am confident that the file is malicious and I immediately removed it and also removed it from the bin, on windows. Is it possible for the .iso file to do something bad without me clicking on it or mounting it? or am i safe because I deleted it quickly?

Thanks for the help! - and if it is bad, any suggestions on fixes? I simple just re install windows.

According to the post on Superuser here, I would say it is safe to say it can't run anything malicious. Pavium's reply is:

I think it's more accurate to say 'a virus can't execute itself, unless it has the cooperation of the Operating System and/or software bugs and/or the user.
If the OS allows files to be executed automatically because of their name or location (for example an email attachment) then a virus can masquerade as a legitimate file and be executed by the OS without user intervention. This used to be the default behaviour in early email clients.
Also, if the OS or specific software has errors that a virus can exploit to run its code, then a virus can start itself.
But users are most often the means for a file to be executed. I was surprised recently when a work-colleage told me she thought her computer had a virus after she opened an attachment in an email from a complete stranger. I thought she would have known better.

I really liked the fact he mentioned:

if the OS or specific software has errors that a virus can exploit to
run its code, then a virus can start itself.

This statement can't be true enough. Around the time I've worked with exploits, and always keeping an eye on the exploit database, the code that's most powerful is, I believe taking advantage of a systems own error. So, the summary is, unless your OS has an error it can exploit to run itself, it can run malicious code and do damage it intends to do. Unlikely, though.


How do I test and secure ASN.1 Parsers? As far as I can tell, .NET doesn't have an ASN.1 parser for reading or writing data built in the framework.  This means that any code that creates or verifies ASN.1 data is using a 3rd party library of varying quality.  Bouncy Castle, and JavaScience for .NET are a few examples of such libraries.

I'm aware of a few production installations that use less widely used, and less tested ASN1 parsers.  Considering the problems of parsing data in the past, and also that OpenSSL is still having ASN1 parsing issues I think that ASN1 parsing is a overlooked concern.

Background

ASN.1 is used in TLS certificates, X.400 electronic mail, X.500 and Lightweight Directory Access Protocol (LDAP) directory services, H.323 (VoIP), Kerberos, BACnet and Simple network management protocol (SNMP) to describe the Protocol data units (PDU) they exchange. Any custom software that reads or writes ASN.1 data outside of a trusted wrapper could expose the system to risk.

See Wikipedia for more information.

Question

How do I test and secure ASN.1 Parsers?
What parsers are more secure than others?
How does .NET do AD LDAP, Certificate oid validation, and kerberos without a built in library?

You cannot really test an ASN.1 parser for correction, because it is a complex piece of software and we do not know how to prove that a given piece of software is correct. What you can do is rely on a library with good repute. You might want to have a look at this question. Alternatively, reimplement it yourself; this is not very hard if you stick to a workable subset of ASN.1 (e.g. only DER encoding, only a few string types,...).

.NET necessarily has some built-in code for doing ASN.1 parsing; this does not mean that it necessarily gives you access to that library.

At least, ASN.1 libraries written in Java or a .NET language benefit from the innate resistance of these languages to buffer overflows (if a buffer overflow occurs, an exception is thrown, which is marginally better, from a security point of view, to actually overwriting data in memory).


Is there a Snort rule that equates to "something suspicious flagged from a client side application?" The reasoning is what if an enterprise monitors snort alerts more-so than say syslog.  Is there a specific pre-defined alert for 'client side app says something fishy is going on'?

Snort looks at network activity, so it would have to be something that the client-side app sends over the network. At that point, you would need to look at the messages that the client sends out, which could be grabbed by Snort. Pre-defined? No, there are too many client-side apps to catch them all.

Snort rule template:

  alert tcp any any -> any 80 (msg: "Client Unhappy";content:"Client unhappy text";nocase;)

This rule is pretty basic, but it's the place to start. To reduce false positives, you would also want to look at the ports the client and server use to communicate messages and refine your rules to look there.

Here is a SANS guide on how to look for certain text, and refinements.


Crypter Anti-Virus Test I have written a very simple/basic crypter in C++ and I would like to test it. How would I go about writing a simple MessageBox program that is "tainted" so that my Anti-virus will attempt to quarantine it upon running the file? Right now, I just have a MessageBox outputting "Hello".

I need a suspicious signature.

P.S. It is a runtime crypter. I worked on it after reading this white paper:
http://www.exploit-db.com/wp-content/themes/exploit/docs/18849.pdf

An idea would be to use the EICAR string. This string was developed to test anti-virus. Try to make a program with that, see if it triggers your av and then apply your crypter.