How to send GET/POST requests without header and agent information I want to test our DOS prevention system against http requests that are not have header and agent information. Is there any tool I can do that. I tried siege with this command

siege -c 3 -b -H "Host: " -A ""  http://10.0.1.2/

This command sends requests with empty host and agent values. What I want is to send requests without defining host and agent values.

Thanks for any advice...

I'm surprised nobody mentioned the easiest way of doing this, with curl :

curl -H "User-Agent:" -H "Host:" http://10.0.1.2/

The -H argument can be used to set custom headers or to remove them by setting no value on them.

Example of what that command does on my site, with -v added for verbosity :

andre@network ~ % curl -H "User-Agent:" -H "Host:" http://andredaniel.me -v
* Rebuilt URL to: http://andredaniel.me/
* Hostname was NOT found in DNS cache
*   Trying 2a01:7e00::f03c:91ff:fe89:63c8...
* connect to 2a01:7e00::f03c:91ff:fe89:63c8 port 80 failed: Connection refused
*   Trying 85.159.208.85...
* Connected to andredaniel.me (85.159.208.85) port 80 (#0)
> GET / HTTP/1.1
> Accept: */*
>
< HTTP/1.1 400 Bad Request
< Server: nginx/1.6.2
< Date: Mon, 29 Dec 2014 13:09:44 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 172
< Connection: close
<
[page contents truncated]

As you can see, both the host and user-agent headers are missing and the web server doesn't like that very much because I use virtual hosts and the host header is essential in that case.


Trace large volume of web traffic, stopped at VPN I have a web server. I recently received a large volume of web traffics, after tracking it down, it is coming over a commercial VPN provider. Is there any way to keep the tracing going, beyond the VPN?

Options:

Ask the VPN provider nicely.
If it's sufficient to do so, get the law involved.
Try to send a payload that identifies the machine. Javascript that returns the ip address, accesses another network (maybe not all of it is VPN), etc.

That's about it for tracing info. You may be able to shut them off without too much effort, but I think it is the business of most VPN providers to not disclose information to the public.


Error tolerant password from quiztest I want to use gpg with a symmetric password for encrypting a message. How to do this is explained here in the forum itself, but also in the internet. I'm aware that a symmetric key has the general problem of key exchange. A possible solution is to make a quiz test. The idea is to take 20 questions from an exam test, which can be answered with a, b, c or d. And this will be the password for encrypting the message. The entropy of the password is 4^20, which is high enough for a little fun exam.

The problem is, that the PGP software needs a 100% correct password. But in reality no student will be able to answer all questions correct. What i need is something which is a bit error tolerant. What is the algorithm to generate a password, which is also correct if only 90% of the questions are answered correct? Can this be done with some kind of hash-function or salt?

The idea from educational perspective is, that the students are first attending a quiz, and if they have done all right, they can read the secret message which contains music. Only the student which were successful can hear the song.

One way you could do this is with Shamir's secret sharing. Your song data would be prefixed with a known-good value (e.g. "RIGHTKEY") then encrypted with a symmetric cipher such as AES-CTR-128, and the shared secret S would be the AES key converted into a 128-bit integer.

Using Shamir's you would generate your 20 points on the curve, each in the form [x, f(x)]. Assign each point to a question, adding the answer's correct value (mapping a,b,c,d to 1,2,3,4) to the f(x) part, such that you get points in the form [x, f(x)+q] where q is the correct answer index 1, 2, 3, or 4. If a student were to look at the page source code, they would only see a point [x, y] and would not know what the value of f(x) or q is.

Upon submission of the completed answer sheet, you go through each answer and subtract the given answer's index from the second part of the point. If the answer is correct then their value will have been subtracted back to the original value of f(x). If enough of their answers are correct, they will have enough points [x, f(x)] to decrypt the secret. As some of their answers may be wrong, you can't just use all of the points. Instead, you iterate through each possible combination of k answers and attempt to compute the shared secret, then use the resulting secret to decrypt the first 8 bytes of the encrypted song and see if the data is "RIGHTKEY". If so, you know you got the right key. If not, you move onto the next iteration and try again. For a value of k=16 with 20 questions, you only need to do 4845 attempts at most; for enough correct answers this will be much faster as you are likely to find a correct combination early on in the decryption process.

Against a naive bruteforce approach, the system has a security bound of 4k for a threshold of k correct answers. The primary weakness is that if a test-taker is absolutely sure of some answers but doesn't know others, they can use the ones they know are correct to reduce the brute-force space significantly. Ultimately, however, this is an inherent problem for any client-side validation approach using thresholds. The only way to avoid this is to have the exam validated on the server-side against a set of known answers.


Security: Oauth and Mobile apps This is what I believe are the security implications of integrating Oauth using embedded webview vs browser in mobile application.

Embedded Webview
* Keep UI for mobile app

 Security implications
    * Makes phishing easy (especially since no address bar to show url and security)

Browser
* Different UI/Context switch (downsides)

Security - (good) :Less phishing ... can see url in address bar
(bad): Bad app can take over custom url scheme and have access to code.

Is there a way to have a secure mobile solution for oauth integration in mobile?

You can use browser + PIN-code verification (oauth_callback=oob). It will become semi-automatic, but will allow you to avoid creating "custom url scheme"

see this article, for example


Google Chrome extension wants to be able to "manage apps, extensions...": reasonable? One image can tell more than a thousand words...
Is what this extension is asking for reasonable?

There are (at least?) five actions it is requesting permission that I do not see what it would need for:

Read all your data on the websites you visit
Change all your data on the websites you visit
Manage your apps
Manage your extensions
Manage your themes

PS: Viber is an Instant Messaging platform, similar to WhatsApp. This extension allows for using Viber inside Chrome. Otherwise, to use it in a PC one has to install the Viber app.

For the purpose of the text search features, and indexing, the alert says:

Add "Viber"?
It can:
Read and change all your data on the websites you visit
Manage your apps, extensions, and themes

Whenever you're considering whether to install a new extension it's important to weigh the risk with the potential reward.

This particular extension has the ability to modify the webpage on any page you view, it does this in order to allow you to share images with a single click, or copy things to onenote.

While this particular extension looks pretty benign, there's always the potential the company loses control of their extension.  This could happen through compromise of the account (attack) or by the company choosing to sell the extension to someone else.  There's been a number of extension authors recently that have decided to sell the extensions they have made, and a new company now can change it however they want, often without having to notify you whatsoever.

Is the ability to share an image with a single click, or save text to one note within your browser worth the risk?  That's something you have to weigh yourself.


Anti Virus Intergration we have found an issue with some production systems that the Anti-Virus causes the program to become slow a lot of the times and generally interferes with the activity of our software. Now as far as I know, this is exactly what the anti-virus is suppose to do in order to protect the machine from files coming in from the network. Most of the times the issue is solved by placing the process and folders of our application in the trusted list. While this is a temporary solution, in the long run it posses a security threat.

I wonder is there a known way to integrate with AV's and telling it when to scan a file? when to trust it? some kind of API both in C++ and in Java. I have seen this issue with McAfee and Symantec.

Any known strategies on how to integrate software with AV?

How does FTP servers and similar software handles such issues?

Support for McAfee and Symantec would cover most of my needs. I can't control which AV the customer places on his machine.

Edit: Just to be clear I don't want to add the process/folders to the trusted list via API. I want to perform scanning through API.

If you want security you scan the file on every access. If you want to take the trade off of less security vs greater performance, then turn off active scanning and just use your scan scheduler.

Your talk of trusting the file doesn't make a lot of sense in the context of file storage and access, however you could just scan on your web gateway inbound before the file lands on your server. This doesn't take into account infection from your server itself, so you'll still want to regularly scan your server.

Your point regarding FTP servers is a bit irrelevant here. It is a server. If you want av on the server, you implement it, and depending on the risk profile you either scan on every access or schedule scans.

If you want greater performance while keeping security, use faster disks, raid or other disk speed improvements.


Why is the Access-Control-Allow-Origin header necessary? I understand the purpose of the Access-Control-Allow-Credentials header, but can't see what problem the Access-Control-Allow-Origin header solves.

More precisely, it's easy to see how, if cross-domain AJAX requests with credentials were permitted by default, or if some server were spitting out Access-Control-Allow-Credentials headers on every request, CSRF attacks would be made possible that could not otherwise be performed. The attack method in this scenario would be simple:

Lure an unsuspecting user to my malicious page.
JavaScript on my malicious page sends an AJAX request - with cookies - to some page of a target site.
JavaScript on my malicious page parses the response to the AJAX request, and extracts the CSRF token from it.
JavaScript on my malicious page uses any means - either AJAX or a traditional vessel for a CSRF request, like a form POST - to perform actions using the combination of the user's cookies and their stolen CSRF token.

However, what I can't see is what purpose is served by not allowing uncredentialed cross-domain AJAX requests without an Access-Control-Allow-Origin header. Suppose I were to create a browser that behaved as though every HTTP response it ever received contained

Access-Control-Allow-Origin: *

but still required an appropriate Access-Control-Allow-Credentials header before sending cookies with cross-domain AJAX requests.

Since CSRF tokens have to be tied to individual users (i.e. to individual session cookies),  the response to an uncredentialed AJAX request would not expose any CSRF tokens. So what method of attack - if any - would the hypothetical browser described above be exposing its users to?

If I understand you correctly, you are saying why is the browser blocking access to a resource that can be freely obtained over the internet if cookies are not involved? Well consider this scenario:

www.evil.com - contains malicious script code looking to exploit CSRF vulnerabilites.

www.privatesite.com - this is your external site, but instead of locking it down using credentials, you have set it up to be cookieless and to only allow access from your home router's static IP.

mynas (192.168.1.1) - this is your home server, only accessible on your home wifi network. Since you are the only one that you allow to connect to your home wifi network, this server isn't protected by credentials and allows anonymous, cookieless access.

Both www.privatesite.com and mynas generate tokens in hidden form fields for protection against CSRF - but since you have disabled authentication these tokens are not tied to any user session.

Now if you accidentally visit www.evil.com this domain could be making requests to www.privatesite.com/turn_off_ip_lockdown passing the token obtained by the cross-domain request, or even to mynas/format_drive using the same method.

Unlikely I know, but I guess the standard is written to be as robust as possible and it doesn't make sense to remove Access-Control-Allow-Origin since it does add benefit in scenarios like this.


Using encrypted config file for MySQL? On my Linux system, I always use a configuration file to log in to MySQL servers without having to enter my password every time. These files includes the username and password.

I have to encrypt this configuration file for security reasons. As a consequence of this, MySQL first has to decrypt this file and then read the password. Does MySQL have any APIs to encrypt/decrypt such configuration files? If no, is there any additional way to solve this problem?

It is unclear from your question when you are talking about the MySQL client and when you are talking about the server. While MySQL can accomodate encrypted passwords in the client (using mysql-config-editor) IMHO a better solution is to use an encrypted home dir (or sub-dir) mounted at login time, not least because it provides a means for storing other secrets.

If we're talking about local databases, then you can rely on the SO_PEERCRED for authentication, if we're talking about remote databases then using an ssh tunnel (with a keypair - possibly held on an encrypted home dir) and SO_PEERCRED might be more appropriate.


Spamming exploits without user detection So I asked this question because I had thought that attackers would have a way to identify client software, because surely if 100 different exploits were spammed against a users machine they would notice?

The answers I got suggest that that is not the case, and indeed the most popular malware kits do just spam a wide variety of exploits hoping to get lucky.

My question then, is how does this happen without users being aware? If you spam PDF or Java or media player exploits, surely the users would notice these programs opening up?

I don't even recall advice to users to be on the lookout for such programs randomly starting up when browsing, which would seem like an obvious clue if this is how drive by downloads work.

So, why are spammed exploits not more obvious?

Why do you assume the user would notice? Starting a program takes a bit of CPU, a bit of RAM, causes a few disk accesses, but that's pretty low-key. Even geeks who have a CPU meter or other common system monitor in their task bar will probably assume it's just some Javascript on a timer in an opened web page, or a garbage collector, or a scheduled task in the operating system.

Maybe you were expecting the program to display a window? The exploit would take care to hide the window, or run the program without displaying its output in a visible window. A very simple way to do that (but not very discreet) is to start the program minimized (for example, under Windows, you can start a program from the cmd command line with programname /min). There are more sophisticated ways that would hide the program more − under Linux, for example, start the program in a virtual display such as Xvfb; there are ways to do this on Windows as well. And even that assumes the program has a GUI; many exploitable system components can be embedded inside another GUI application (and the exploit would then take care of providing a wrapper application that doesn't actually display anything) or just don't have a GUI.

In a web context, an exploit in the form of some resource (image, document displayed in a plug-in) on a web page could be styled to show as a single pixel in some remote corner, even stacked under some other element for good measure. Who checks all the media used by all the frames of every web page?


Protecting against CSRF, JWT, cross domain I have a frontend heavy app with a rest api in node.js. The app and the backend are on different hosts. Moreover, the app can be accessed both with http and https. The reason why is mixed content: users of the app load their own websites in iframes, and if a website is http - it won't work, broken red https at best, not loading at all at worst. Pretty ironic that something that is supposed to improve web security, is forcing me to allow using non secure connections myself. But that's not the point. So let's say I have my frontend at http(s)://app.mydomain.com and backend at https://api.mydomain.com

And I want to make it as secure as possible, considering that my users will sometimes use insecure connections. I know that I can't protect from tampering, but at least I can protect authentication token. So I use JWT. I also want to have remember me functionality. localStorage/sessionStorage would allow the token to be read on insecure http page, so I was thinking about just setting a cookie for https://api.mydomain.com on the server. This way, the frontend can never read the token due to CORS. And I would skip all these refresh token stuff. There would be just one token to be used for everything. So if a user logged in, the server would set the token cookie and set it to expire when browser session ends, the token itself would be set to expire in 1 day. If user checked remember me, then the cookie would be set for one year and the token would be set to expire in one year. Now I'd like to ask you if that's a secure way to do it? Am I thinking correct?

Another thing obviously is CSRF. I was thinking just to check the referer and leave it at that, but I heard it could block legitimate users behind proxies that remove referer from the request. So I was thinking on using JWT as nonces. Basically on init, when the user logs in/authenticates, the server returns a new token and then the token is stored in client memory and sent with each request to the server to be verified.

Here's a summary of the process:

the frontend is at http(s)://app.mydomain.com
the server is at https://api.mydomain.com

0. make an ajax call to check if the user is logged in
1. send username and password to log in
2. the server sets the cookie at https://api.mydomain.com containing the auth token
    cookie is set to expire when browser session ends, token is set to expire in 1 day
    if remember me: both cookie and token is set to expire in 1 year
3. the server also generates a different token to serve as a nonce and returns it
4. the app stores the nonce token in memory and uses it for every call

If the user is logged in, skip to step 3.

Wht do you think? Is it secure?

In general there isn't anything wrong with the authentication and anti-CSRF strategy outlined. Incorrectly implementing any part of it could, of course, expose risk but the strategy on its own seems fine.

There are a few areas of concern that are not ideal, the biggest one you already identified: supporting unencrypted use of HTTP. As you correctly pointed out, this exposes significant man-in-the-middle risk. In addition to the inherent risk for visitors or users choosing not to use SSL-encrypted communication, but also generally exposes greater risk for SSL-stripping attacks against users that intend to use SSL. Something you might consider here is making an SSL-only option available at the user (or user organization, if appropriate) level. Implementation details would depend on stack, but if you're using something like Express or Koa you could have a piece of middleware that validates that HTTP requests are allowed before returning a response. In cases where they aren't allowed you can respond with a 302 redirect to the HTTPS path.

The main advantages I can see for using a cookie versus local storage in this case are that:

The HTTPOnly flag mitigates risk of token theft via cross-site scripting (XSS). This certainly would not be the only concern if you have XSS flaws however, as successful exploitation could still issue requests from the compromised session.
If you determine whether the authentication is initially done over SSL (HTTPS), you can dynamically add the Secure flag to the cookie when you issue it so that SSL-stripping exposes somewhat less risk since the token would not included as long a the auth was secure in the first place. I would hesitate to call this infallible defense against SSL-stripping, but it's an easy way to add a little bit of defense in depth.
I may me missing a way as I must admit I've barely ever used the localstorage API, but I think you would need to scope localstorage to the whole domain, which means if anotherapp.mydomain.com (in keeping with your example) is vulnerable, it could compromise your localstorage containing your token. With the cookie, you can scope it to api.mydomain.com and use fairly restrictive CORS headers such as access-control-allow-origin: app.mydomain.com with access-control-allow-credentials as well.

It's not clear to me whether what you're putting in the iframes is intended to in some way interact with your content - something I would certainly caution against. In an ideal case, you would be able to stipulate that all embedded content have a valid SSL cert, and just use HTTPS throughout. Without that you are simply not going to have robust enough defenses to be reasonably confident against man-in-the-middle attacks.


How to audit login on a Debian distribution if var/log was deleted Last week I had a linux debian distribution accessible from Internet compromised through SSH for 24 hours. As far as I know the attacker could get root privileges and performed some malicious actions.

The attacker deleted the .bash_history file, the entire /var/log folder and rebooted the machine.

I've been trying to recover inodes from deleted logs but debugfs does not show results. The command "last" does not show as log file was deleted.
The file "/var/log/auth.log" was deleted as well (as I said, entire /var/log directory was deleted).

Don't know where to look as this is a standard distribution with no additional packages installed, as almost all tools uses /var/log folder for storing that kind of information. Any ideas?

Your best bet is searching for "forensic data recovery linux" and going from there. Keep in mind, though, that if the attacker was any good, they probably didn't just delete the logs, but used a tool like "shred" that specifically makes file recovery near-impossible (or at least very expensive).

There isn't that much useful info you can get from those logs, though. You can probably find an IP used to launch the attack, but you'll most likely trace it back to a TOR exit node.

For the future, one of the best things you can do is set up a hardened network syslog server that would collect syslog data from your Internet-facing systems. This will allow you to analyse your log data even if your local logs have been deleted.


How risky is having sensitive files on webroot? I understand that having anything sensitive under webroot is not smart; someone may be able to access it via url. However, I do not have a choice with my web host (iPage) as they limit my server space to just the web root.

So my question is: how risky is it to just have sensitive files in a directory in a webroot with just simple forbidden public access? My gut says no, and any insight on this topic would be greatly appreciated.

Edit: The 'sensitive files' are an installer for our startup's software and the php files that allow the download / control sql access.

An attacker is going to use forced browsing to try and find sensitive files.  DirBuster is very useful in performing forced browsing attacks, and it commonly finds sensitive files on my penetration testing engagements.  DirBuster comes with a very large list of common file and directory names.  If it's not a common file-name,  DirBuster probably won't find it.

Having sensitive files accessible anywhere on your web-server is dangerous, there needs to be some form of access control in place.


How do you handle vulnerabilities in internal systems? A constant source of debate I've seen between engineers and security teams is how to handle vulnerabilities in internal systems. Specifically, vulnerabilities in linux packages (like gcc, libcurl, openssl, libpng, etc.) inside Docker containers. Many times these packages are not used by the application and they just come with the OS, while other times the packages are used extensively. How do you handle prioritizing and fixing these vulnerabilities in systems that aren't accessible from the public internet? These images are things like databases, caches, internal-only apps, etc. Do you just take the NIST CVSSv3 score as-is? How does this change when the number of vulnerabilities to review is in the hundreds or thousands?

If you need a specific example, say a high severity vulnerability identified in the nfs-utils package on a database container.

Handle vulnerabilities by using Vulnerability Management
Vulnerability Management includes patching, but so much more. It includes assessing the vulnerability and assessing mitigation actions (of which patching is one) in the control environment.

Do you just take the NIST CVSSv3 score as-is?

Well, yes. There is no need to change the core assessment of the vulnerability, but the CVSS score does not tell you what you should do about it. You need the CVSS score as part of the risk assessment, but you still need to assess the risk in the control environment in which it exists.
For example, if there is a vulnerability that can only be exploited over the network, and the machine does not have the ability to connect to a network, then that threat is mitigated.
It gets more Complex than that
When most people raise this type of question, they are expecting that the Complex problem is meant to be solved with a Simple solution ("Just Patch"). But when patching is not practical, how do you perform a risk assessment that does not end up exposing hidden risks due to the team's lack of experience or perspective?
We all know that the risk assessment can get complex since the technology, the vulnerability, and the control environment can be so complex that people might not ever trust their ability to perform a risk assessment properly or completely. So, when you have to start "making it up as you go along" to meet your unique and situational needs, you need expert advice and carefully chosen layers of controls (Identify, Protect, Detect, Respond, Recover) to prevent the unintended consequences of ad hoc controls in a complex environment. And that's all part of Vulnerability Management, too.
Docker/Containers
So, a Docker or any other containerised environment does not change the fundamentals. Containers can be exposed externally, or not, they can be exposed internally, or not, or they can be restricted to the local host, or not. Just like any other service. You still need to assess the control environment. And when you do, consider the future use of that machine, container, or service. Whatever vulnerabilities you permit to exist counts as a debt that you will have to resolve if you change the use case or the control environment that you used to allow the vulnerability to remain unpatched.
The quick answer
Patching is the simplest, most straightforward, and recommended default action to take. You should have a policy/standard where you patch unless there is a compelling reason not to and you engage compensating processes (Identify, Protect, Detect, Respond, Recover) that take the current and future control environment into consideration.
Rule #1: When in doubt: patch.
Rule #2: When patching presents a material risk to objectives: make sure you know what you are doing.
Rule #3: If you are not sure you know what you are doing: see Rule #1.


How do I check the hash of an ISO? If I download the OS image from Ubuntu servers from a location where I can get the MITM attack and get a compromised image, then how I can check its hash to prove that its original image?

Hashes may be replaced on official site by the MiTM attacker. But it is not a problem because I can check them on an IRC channel or somewhere else.
Software that I can use for checking sums can be compromised to show the correct answer on a compromised file.

Before I asked this questions I heard that Ubuntu have PGP signed repositories so they can't be compromised but... Here is interesting thing that I read:

Quote:

  If apt's sources.list file was modified, one could also redirect to a
  location providing malicious updates (and signed with "trusted" keys,
  if these have been added, altough not Ubuntu's ones).

  An attacker
  could have changed pretty much everything, including the actual
  verification of OpenPGP signatures or include arbitrary malware and
  backdoors.

  So how can be solved this dilemma?

I mean check the image on originality if I can't trust download source and we will suppose that I have not had any social connections except with websites.

You are overthinking this.

It's possible that an attacker intercepts your connection to Ubuntu servers and redirect your download to a tainted image, but it's a difficult task:

They have to be in a position to be able to MiTM your connection, by standing in the route between you and the Ubuntu Servers
Maybe perform a DNS attack on you to redirect you to another server that they control
If you access Ubuntu using HTTPS, they must strip the HTTPS or provide a valid certificate. Providing a valid certificate requires either a malicious CA issuing the certificate, or presenting a fake certificate AND you allowing it.

After this, if you download the image, you could run a hash check (MD5 or SHA) and verify the image. This is very easy to do, and very, very difficult to taint.

After all, there's lots and lots of programs that can calculate the hash, and the attacker will never be able to compromise every single one out there. You can even calculate this using Javascript in any browser. So it's impossible to an attacker to compromise every hash calculator you could use.


How easy is it for hackers to gain unauthorized access to resources on an Android phone? I caught a segment of an NBC news story describing how hackers can access messages, phone conversations, location, camera, microphone, and more provided that they can install a malicious app on your Android device.

In the video, the cyber security expert gets the correspondent to click on one link on his phone and then tells him he's compromised. Two questions:

How could someone be compromised that quickly by merely clicking on a link? Don't modern browsers prevent any sort of app from being installed without asking the user first? Is there some JavaScript exploit at play here?
How is an Android app able to access so much of this information anyway (provided that it's installed)? I take it that the only way to access these resources (be it messages, hardware, whatever) is through the standard Android SDK, and that the OS would prevent complete and open access to those resources without the user permission.

Summary of Video:
James Lyne, Sophos Global

James shows a complete RATting of an Android phone by simply clicking a link. It is explained that this is possible if the user allows the installing of apps from outside Google Play.

(Difficulty: Incredibly Easy): If you're in Developer Mode, many of the restrictions in place to keep you safe are missing. This makes it easy for developers to test apps, but makes the device incredibly insecure. Thankfully, turning on Developer Mode is non-trivial in newer versions of Android (just a few years ago, it was not much more than a checkbox in the main settings menu). This mode should always be disabled on hardware that contains any data you care about.

(Difficulty: Easy): If you allow installs external to the Play Store, it's possible to spoof permissions due to various glitches in the permissions API. Without using the Play Store, your device can install non-Google managed software, including malicious software that can be linked to from a normal URL. It's also possible make a "no-permissions app" that later elevates its permissions through a stack overflow/underflow or buffer overrun/underrun exploit. I don't know of any specifics about those types of vulnerabilities, but I would presume that such attacks are possible.

(Difficulty: Moderate/Dependent): Some devices are "rooted" by the user, which is necessary to install some classes of apps that are not ordinarily allowed. This bypasses many of the restrictions that Linux provides, because the user is now logged in as "root", giving superuser access to the user and all apps that they install or run. Many people don't realize this is a bad idea, and so are later surprised to find out their device was compromised simply because they gave the primary user account elevated privileges (translation: they didn't know what they were doing, and what the risks were).

(Difficulty: Hard): Otherwise, if you're not in Developer Mode, and you're not allowing external installs, and you haven't rooted your device, there are vulnerabilities that exist in various scripting engines that are used by the Play Store and other apps. These can be exploited through UXSS (Universal Cross Site Scripting) attacks, where the main installation intent is invoked without the usual permissions dialog, and the only thing that's necessary is loading the script in memory through a link in a message or email. For example, Android Jellybean and lower could be hacked this way. Never trust links from sources you don't trust, and consider installing security software to reduce the likelihood of unwanted installs. NOTE: As far as I know, most apps automatically attempt to invoke an intent rather than check for some arbitrary notion of security. That is, the browser doesn't know if you meant to install an app, but it looks like you did, so it sends this request to the installation intent/Play Store.

Note that this isn't unique to Android, as iOS, Firefox OS, and Windows Mobile all have potential vulnerabilities, especially if "rooted" or otherwise modified than ways that were intended. It's also possible that carrier-provided software (those annoying apps you can't uninstall) could also have vulnerabilities, and you might not even be able to uninstall or disable those apps.


Unknown URL parameters in google query I received an email which is classified as "potentially malicious" by my email program (Thunderbird), where links are actually a google URL query with extra parameters:

For example, the displayed text of the link is www.example.com/ but the actual link is https://www.google.com/url?q=http://www.example.com/&sa=D&ust=1535125407413000&usg=AFQjCNFsIVH5f4lBiIzr6njucxAoYFqy5A

I searched everywhere the meaning of those extra tags sa=, ust= and usg= but there is no official reference about it, and for example, the links provided in this answer seem outdated...

Also, I just noticed this is not a search, but an URL query (www.google.com/url?).

Is there something to worry about in this e-mail? Does anyone have an explanation of these URL parameters? How was this link made?

It is not a question of the parameters, but that the URL given in the links text and the real URL of the link point to different domains - which is a common technique in phishing mails.

To cite from Thunderbird’s Scam Detection:

  Thunderbird's automatic scam filtering ... It looks for
  characteristics in messages that are common in scam messages, for
  example: ... Links where the text doesn't match the server
  name (for example, the text of the message might say
  "https://secure.example.com" but the link actually goes to
  "http://phishing.example.com" instead). Phishers do this to fool you
  into going to their site. Unfortunately some legitimate mailing lists
  also do this with redirectors for tracking purposes.


Best security algorith for storing passwords Possible Duplicate:
  Which password hashing method should I use?

I want the best cryptography algorithm for storing passwords in database, which one should I use and how can I implement using java code and please suggest available APIs for the same algorithm also.

IMHO the best password storage function is scrypt.  This algorithm became my favorite key derivation function after reading Stronger Key Derivation via Sequential Memory-Hard Functions.  Scrypt can use an arbitrary amount of memory or cpu time.  This feature makes scrypt very difficult to crack using an FPGA or GPU.  It should also be noted that ChromeOS uses scrypt in an interesting design.

A java implantation can be found here.


Is it safe to automatically parse text as markdown? I have a server, which receives text mails from students and I plan to automatically collect their message bodys and parse them as markdown so that I can generate a nicely formatted output as pdf. Is there anything I need to be cautious of if I automatically do this parsing? Is there anything I need to intercept to avoid unwanted behaviour/code execution (similar to a sql injection)? Or is it safe?

It depends on how the parsing and conversion software works.  Although markdown is mostly text, one can insert html code into markdown.  By markdown standards, a markdown parser usually can support the rendering html code.  Basically, if the e-mail has html code in plain text, the markdown converter may copy that text into markdown directly (with no formatting if the text is not formatted).  This may cause html to be parsed from the markdown file.   [1]
I am not sure if you will be using two different or just a single software to convert from text e-mail to md(markdown) to pdf.  However, I do not think that may make a difference.  The only vulnerability I can think of is at your end, where the md to pdf converter may parse the md when converting (which may have html content).  If the converter does not do parsing but just looks at the md file, then there may not be any issue, as there is no way to have dynamic HTML rendered inside a PDF file.
The only vulnerability I can think of relating to html inside of md, is where the html code has an <iframe src="virus url"></iframe>.  This may cause your md to pdf converter to download a virus on to your computer.
This is one of the reason why some html elements don't get parsed and are removed from GitHub README.md markdown files.  [2]


Why doesn't my manual RSA key exchange example work? I'm trying to "manually" compute  how the premaster_secret is computed using the RSA key exchange in TLS 1.2, but can't manage to make numbers meet. I am using Scapy SSL to generate a TLS session:

I retrieve the e and n parameters from the first certificate's pubKey (Certificate message)
I retrieve the premaster_secret from Scapy
I compute (premaster_secrete mod n)
I compare this result to the Encrypted Premaster sent in the Client Key Exchange message, but it is never the same

Am I missing something?

Thanks to the responses I was able to get it working. Here is some Python pseudo-code which explains the algorithm actually used by TLS 1.2:

# Come up with a random premaster_secret
# It needs to start with the TLS version (0x0303)
premaster_secret = '\x03\x03' + os.urandom(46)

# Retrieve the RSA parameters from the certificate public key
RSA_n = ...
RSA_e = ...

# Encodes premaster_secret using PKCS#1 v1.5
premaster_secret = '\x00\x02' + '\x12' * (256 - 3 - len(premaster_secret)) + '\x00' + premaster_secret

# Converts the result into a number and encrypts it
premaster_secret_nb = int(binascii.hexlify(premaster_secret), 16)
encrypted_premaster_secret = pow(premaster_secret_nb, RSA_e, RSA_n)


Numerous login attempts detected from an internal machine to the active directory domain controller We have recently identified numerous login attempts from an internal machine to the active directory domain controller. The attempts are directed at the domain administrator account.

As an initial response, we checked to see whether there was some malware on the host machine that was initiating these attempts, but a scan from our AV did not return any results. Soon after this we checked the list of programs installed on the machine and everything was as per standard rollout on a user machine. Also to verify whether or not there was an automated tool, I changed the IP of the machine an re-connected it to the network by logging in to the domain and logging out of the domain, keeping it connected to the network. In both instances, the only traffic observed was a single IPC$ connection to the Active Directory DC.  There were no login attempts.

How can I detect what caused the multiple login attempts?

Migrated comment to an answer as it should steer you down the correct path.

First Determine Failure Type

Are these Kerberos Pre-auth failures (Event ID: 4771)

OR

Actual login attempt failures (Event ID: 4776)?

Then ID the Specific Failure Reason

View the alert and ID the hex code that explains the failure.

Then look it up here:

4771 Failures
4776 Failures


Encrypting a symmetric key or Small File using TPM and Windows (TBS?) I'm looking at encrypting a small (500bytes) file using the TPM. This is either doing assymetric encryption with the TPM directly, or using the TPM to store a symmetric key for decryption. This needs to work on Windows (7).

I'm assuming I can do this with tbsip_Submit_Command through The TBS/WIn32_TBS, but haven't really seen any concrete info on how to prepare that sort of statement.

Can someone point me in the right direction?

I was able to do this fairly easily with jtSS http://trustedjava.sourceforge.net/index.php?item=jtss/readme

After installing the windows service,
jtt create_key to create a key, then jtt seal to perform the sealing.

example commands:

>jtt create_key -u 00000000-0000-0000-0000-000000000000 -t storage
>jtt seal -i message.txt -o message.enc -p 1,2,5 -u 00000000-0000-0000-0000-000000000000
>jtt unseal -i message.enc -o out.txt -u 00000000-0000-0000-0000-000000000000

-p specifies the PCR registers, and these represent the different values of the machine state (bios, boot devices, etc)
-u is the UUID of the key being used.


How can I be sure Lastpass really can't access my passwords? The recent, widely publicized security incident where millions of Linkedin were exposed reminded me to tighten up my password practices. I'm looking at several password managers now and I'm especially curious about Lastpass.

They write on their homepage:

  LastPass is an evolved Host Proof hosted solution, which avoids the
  stated weakness of vulnerability to XSS as long as you're using the
  add-on. LastPass strongly believes in using local encryption, and
  locally created one way salted hashes to provide you with the best of
  both worlds for your sensitive information: Complete security, while
  still providing online accessibility and syncing capabilities. We've
  accomplished this by using 256-bit AES implemented in C++ and
  JavaScript (for the website) and exclusively encrypting and decrypting
  on your local PC. No one at LastPass can ever access your sensitive
  data. We've taken every step we can think of to ensure your security
  and privacy.

How can I be sure that the bolded part is true? Is the method they describe capable of actually doing what they promise, can it prevent them from accessing my passwords? And how could I verify that they're actually doing what they're promising and not transmitting my password in any form they can access to their servers?

There is a way to see if LastPass is doing what they're saying.

Use the Non-binary Chrome, Firefox, Opera, or Safari extension.   This is 100% JavaScript and open in the sense that you can see it -- you can use network sniffing with a proxy (e.g. Paros) to see that the sensitive data is encrypted with AES-256-CBC from data generated from a key created with the number of rounds of PBKDF2-SHA256 you have setup on your account: http://helpdesk.lastpass.com/security-options/password-iterations-pbkdf2/ and this is done locally on your machine only.

Then simply don't update/upgrade your extension until you want to audit it again.  You could also audit the way we interact with the binary extension to decide if you trust that.

That's a bit extreme for most people, but a number of people and organizations have audited LastPass and liked what they found.  LastPass is always helpful to anyone wishing to audit, feel free to contact us if you'd like help.

LastPass knows that it's perfectly reasonable to trust but verify, and encourage you to do so.  There's a reason we tell people to utilize the extensions rather than the website: the extensions can't change as easily as the website could thus making them more secure.

Source: I work for LastPass.


Would people object my website just because I use Google Analytics, +1, or FB Connect? Are there people who will refuse to use a website just because that site sends browser information to Google Analytics?

Could the +1 button be a red flag?

Should I expect that there would be similar thoughts around Facebook Connect?

This depends on your target group.

Like, Tweets, +1

In Germany, for example, the privacy advisor of several states have claimed that the Facebook like-button violates German privacy laws. The threats by the privacy advisor of the state Schleswig-Holstein, to fine the governmental organizations and companies, which do not remove those things, got wide media attention.

Still most people will not care at all. But if you have a target group, that is very aware of privacy issues and Facebook repeated violation of the laws, this might have a negative impact. Although it is more likely that his group is using browser extensions to suppress the social plugins anyway.

Heise developed a two clicks for more privacy approach, which only loads the social buttons after the user clicked on a placeholder.

Google Analytics

As far as Google Analytics is concerned, you can probably get similar information by analyzing the server log files. There is a number of tools available for that.

Facebook Connect, OAuth, Open ID

They can be embedded in a way, which does not send any information unless they are actually used. So instead of using the JavaScript SDK for Facebook-Connect, just add a button with a locally stored image and a plain link to the Facebook permission page.

But it may be an issue, if Facebook is the only way to authenticate.

(Since you asked about the public opinion, all links go to press coverage. Unfortunately, I am primarily aware of the press coverage in my own country, so those links go to German sites. Google Translate might be helpful).


“Self signed certificates” fail, but trust store not I'm using paho.mqtt.c to connect in a "Self signed certificates" way to a MQTT broker.
I have 3 files I use:

- CAfile.pem (CERTIFICATE)
- PrivateKey.pem (PRIVATE KEY)
- Certifcate.pem.crt (CERTIFICATE)

When CAfile.pem contin the last certificate in the chain.

When connecting using the below I get a "Verify return code: 0 (ok)":

openssl s_client -connect 1234.iot.eu-west-1.amazonaws.com:8883
                 -cert Certifcate.pem.crt
                 -key PrivateKey.pem
                 -CAfile /etc/ssl/certs/ca-certificates.crt  #!!!!

When connecting using the below I get a "Verify return code: 20 (unable to get local issuer certificate)":

openssl s_client -connect 1234.iot.eu-west-1.amazonaws.com:8883
                 -cert Certifcate.pem.crt
                 -key PrivateKey.pem
                 -CAfile CAfile.pem  #!!!!

I found out that the reason for the "Verify return code: 20..." is that Starfield Class 2 (that are in my ca-certificates.crt) is missing.

When I concat Starfield Class 2 to my 'CAfile.pem' it works.

Why the failure? How do I resolve it?

It looks like that Starfield Class 2 CA is the root CA for the servers certificate. This root CA need to be included in the trust store. It is  not fully clear what exactly CAfile.pem contains but from your description of "..contin the last certificate in the chain" I assume it is the server certificate and not the root CA. Since the server certificate is not a CA certificate at all it will simply be ignored when given in the -CAfile parameter since this - as the name suggests - expects CA certificates.


What threat model implies any benefit to drug dealers using candy bar dumb phones for business with iPhones for personal use? I mean if law enforcement or other state actors are surveiling their comms, it makes sense to have it be anonymous, but I just saw a guy who was obviously a drug dealer in the underground with an iPhone in one hand and two Nokia feature phones rubber banded together back-to-back and thought that realistically the type of cell-tower triangulation and coordinate correlation that would need to be done to correlate his identity as The owner of both the iPhone and the work phones is already done completely automatically/preemptively/wholesale/dragnet-style. Snowden disclosed the NSA giving tips to local LEAs and the DEA while requiring them to conduct parallel reconstruction so as to protect the NSA's racket and also to avoid invalidation of evidence by fruit of the poisoned tree/Wong Sun (?) doctrine. Is there realistically any security advantage to maintaining dedicated devices for illegal business?

Sounds pretty sensible to me. There are clear security benefits as long as they correctly compartmentalize their usage.

I don't think that the NSA / GCHQ  threat model applies to most dealers. Without any other other inidicators (terrorist email history / known to the authorities / saw them looking dodgy with 3 phones) then there are a huge amount of phones that are co-located legitimately for large portions of the day. Especially in a city with tower blocks, work/personal phones, different networks etc there is a huge noise to signal ratio.

A low/medium level dealer has a threat model of local law only. Compromise can happen via customer or supplier or possibly by observation on the street. Any of the candy bar phones can be disposed of at will. Rotating the number via copying numbers between phone and sim is pretty quick and simple. One phone for customers, another for suppliers and the iPhone for personal.

In case of customer compromise ditch that phone, supplier compromise ditch the other. Caught on the street, ditch both in different places. Keep the personal phone...absence of a phone just encourages the cops to look for the ditched ones and that phone is clean.


What is a root method and how is it achieved? I'm wondering what exactly happens when you are finding a root method on Android. Is it just poking and prodding?

I know it's high privileges, but how can that not be enabled through a regular terminal?

I'm trying to find a new exploit and want to look at old ones to figure it out.

Most older Android "root methods" are using kernel exploits or exploits for drivers or applications running as root. More hardened phones are often attacked by booting an purpose crafted image without security measures in place.
Goal of both methods is to place a su binary on the device that allows the user to give access when needed, without any further checks (it might trigger a dialog to confirm root access or be totally silent). If a device ships with a su binary already it is replaced as the original binary will not grant root access to the user.


How safe are data you dial to a call center? Sometimes when you call an administrative service it tells you "Dial 1 to access such service. Dial 2 to access some other service. Otherwise, dial 3."

No harm if somebody comes to learn I chose "2".

However I recently switched to a new bank. When I call this bank, it asks me to dial my customer reference and my passcode.

Here are the things that come to my mind :

Is such data cyphered? I don't know much about phone communications but I guess there are nodes between me and my interlocutor. May I trust these nodes?
May somebody listen to the conversation and catch my credentials?
May somebody spoof the phone number of my bank to catch my credentials?
Shouldn't my passcode be hashed? Is it stored as plain? I think even my bank should not know my passcode. (this question was obviously wrongul)

Your sensitive information travels through different mediums and systems to get to the bank, and yes, there are vulnerabilities along this path.

First, it is transmitted from your finger tips to your dialler application. It can be intercepted by malware running on your phone. There is a new vulnerability in Android called Stagefright that can get full access to an Android phone.
Before exiting the phone, the data is sent to a different part of the phone which does the actual communication called the baseband processor that runs a realtime OS. There were  some vulnerabilities in this OS, some of the most interesting were presented here.
Then the audio tones (DTMF) are encrypted and sent overt the air to a GSM base station. In almost all of the world, GSM is encrypted and almost any phone will notify you if there is no encryption. The problem here is that 2G communication is using the A5/1 encryption scheme that was purposely weakened for governmental access and it's easy and cheap to intercept and break it. 3G and 4G have better encryption but an attacker can jam the safer frequencies around the target and force the target phone to use the vulnerable 2G. An bigger issue here is that some banks use SMS to authenticate banking operations, and SMS is always over the 2G network.
There was also the allegation that the NSA hacked the database of most of the world's SIM encryption keys, but Gemalto swears NSA didn't get to the keys.
But the phone can be talking to a fake base station. This kind of fake GSM tower is often called an IMSI-catcher and is available to law enforcement and also attackers. There is open source software and hardware to build a fake base station and it was demoed in 2010.
Then the information travels inside the telecom network where it might be intercepted by a well placed attacker or governments that obtains a legal wiretap. In 2014 the SS7 attack was made public. It allows to track and intercept 3G communication anywhere in the world, not just local.
The last step is in the bank's systems. That looks like a safer place because banks take security more seriously than common businesses, but you can't really know for sure until an assessment can validate that.

Going back to your questions:

  Is such data cyphered? I don't know much about phone communications
  but I guess there are nodes between me and my interlocutor. May I
  trust these nodes?

As I said, voice communication is encrypted but there are vulnerabilities in different parts of the network

  May somebody listen to the conversation and catch
  my credentials?

It is possible. It depends on your phone, the capabilities of the attacker and the vulnerabilities of your mobile-phone operator.

  May somebody spoof the phone number of my bank to
  catch my credentials?

There is no GSM vulnerability I know of that works like that but there has been malware that will block access to your online banking then will make you call a phone number pretending to be form the bank. This way a user is less suspicious when giving sensitivity information away.

  Shouldn't my passcode be hashed? Is it stored as
  plain? I think even my bank should not know my passcode.

I don't know what is the actual process when you access your bank via a phone call, but your bank doesn't have to store your passcode in plaintext. When you transmit it, it could then be hashed and compared to a hashed version stored in the bank's computers. This is no different from web authentication where passwords transmitted in plaintext.

But don't panic, the overall risk of you specifically being targeted this way is rather low because the bad guys have other easier ways of stealing from large numbers of users. The risk is lowered also because many attacks on GSM require physical proximity and increased sophistication. Banks can quickly close such vulnerabilities because they notice if some cards or accounts are being compromised and they will track down the source of the compromise.


How to access Replay Protected Memory Block (RPMB) in eMMC? RPMB is a special partition in eMMC 4.5. Internet research suggests that it is used for saving keys and is the only special partition that responds to commands like READ, WRITE. etc. Can anyone explain to me how to use RPMB and how it can actually mitigate replay attacks?

RPMB can be used using mmc-utils.

It can withstand replay attacks by requiring a key to write to this region. The rpmb has a key that can be programmed once. Later, the host reads a counter value from the rpmb. It uses this counter value and the programmed key to generate a MAC. The device then checks the MAC given vs the MAC it calculated using the same key, and if it matches, write access is granted (reference, slide 4).


Can I Hook Up A Infected Drive To Another Computer? I have an old computer that has old games on it and has some kind of virus or such. If I hooked up its drive, would I be able to copy the files over to my laptop, or would even connecting the drive trigger a virus?

would I be able to copy the files over to my laptop

If you are sure the disk is infected with virus, better scan the files and copy file only when it comes clean. Malware hiding frameworks and other similar tech(crypters, packers, encoders, binders, obfuscators or mix & match of similar tech) does a fairly good job of hiding the virus. Its always better to scan with multiple scanners to be sure of the file being free from any virus(malware). I suggest you give a try virus-total though many virus(malware) will not be detected by virus-total right away but it doesn't hurt to try the best possible way to avoid files which may detect infectious.

or would even connecting the drive trigger a virus?

It depends upon the nature of virus. Kindly consider taking calculated risk only if absolutely necessary, by studying the characteristics/specifics of virus detected.


Is an encrypted hard drive immune from malware if it is not mounted when using a LiveCD? As a follow-up to the question in The DMZ, is an encrypted drive (full disk encrypted e.g. LUKS, BitLocker) protected against malware if it is not mounted when using a LiveCD?

The use case is that no other devices are available and there is a need to inspect potentially malicious files.

The assumptions are;

The malware is not designed to wipe drives and for malware to wipe a drive it must be executed on the host that has a decrypted volume/partition.
When a drive is fully encrypted, there are no unencrypted blocks that the malware can write to without mounting the drive.
Malware can only affect an encrypted drive if it is mounted decrypted.
If malware is executed, when running a LiveCD, it is limited to memory and cannot affect firmware or BIOS.
Methods such as dd are not considered to be part of the threat model.

Note: The use of drive is synonymous with disk for the avoidance of doubt.

It's protected in the sense that malware cannot be installed on the unmounted encrypted drive. However it's still possible for the encrypted drive to be damaged or destroyed if the drive can be written. A simple dd to the raw unmounted drive can destroy it.

 ----  Edit  ----

If the encrypted drive is a bootable drive, then there is an unencrypted boot partition that could in theory be modified in an "Evil Maid" equivalent.


Disabling built-in Wi-Fi adapter and protecting Wi-Fi's MAC address on a laptop I have an XP laptop with Wi-Fi issues - it connects / disconnects intermittently. Anyway, I bought a USB Wi-Fi that works well.

My security question are:

Is there a way to completely disable the built-in laptop's Wi-Fi adapter?
I have disable Wireless Network Connection from Network Connections. I do not see the Wi-Fi adapter's connection, when I do ipconfig /all; However, I'm concerned people with hacking tools are still somehow able to see and use that route into my computer.
When I'm not online through the USB Wi-Fi, I can still see my Ethernet adapter's Physical Address / MAC address when I do ipconfig /all. Should I be concerned? How do I guard this piece of information?

The MAC address is specific to a network interface (e.g. your WiFi adapter) and is used for local routing of packets. Every packet sent by a given interface will bear that address, so it cannot be assumed to be secret. On the other hand, knowing your MAC address does not give a lot of power to an attacker -- at best, that attacker could mimic your MAC address so as to fool stupid WiFi access points configured to allow only computers with specific MAC addresses to connect.

So there is no need to be concerned over revealing your MAC address, but, also, your MAC address is not revealed until you actually emit packets.

Shutting down your built-in WiFi, when you don't use it, is a good idea; otherwise, an attacker could pose as an open access port and induce your laptop to connect through it. As a general rule, the Internet is a wild place and you must assume that every single machine out there is hostile -- however, there is no point in actively helping attackers to mount easy Man-in-the-Middle attacks. Most laptops have a "kill WiFi" button (so that the machine may be safely used in airplanes); this might work for you. Alternatively, try removing the driver for your WiFi adapter (that's brutal but it should work).


When does the same-origin policy prevent a request from being sent? I have been dealing with some confusions on the same-origin policy.

Let's say my attack looks like this. On page at evil.com the attacker has put (jQuery):

$.post('http://bank.com/transfer', { to: 'ciro', ammount: '100' })

The attacker then convinces you to visit evil.com.

Will this payload (jQuery) still execute? Would it send a request or throw an error without sending the request?

I am comparing this with XMLHttpRequest where the request at least goes but the response is not allowed to be read because of same-origin policy violations. In case of SOP violation, does the request always travel to the server? Are there any cases where SOP prevents the request from being sent and catches it before?

Would it send a request or throw an error without sending the request?

Your POST request would be sent. However, the same-origin policy prevents that are you are able to read the response. Just like an ordinary form submission, it's a type of cross-origin write. Here is an overview from Mozilla:

  Cross-origin writes are typically allowed. Examples are links, redirects and form submissions. Certain rarely used HTTP requests
  require preflight.
  Cross-origin embedding is typically allowed. Examples are listed below.
  Cross-origin reads are typically not allowed, but read access is often leaked by embedding. For example you can read the width and
  height of an embedded image, the actions of an embedded script, or the
  availability of an embedded resource.

In your scenario, the request would trigger an involuntary action (a bank transfer). This type of attack is called cross-site request forgery (CSRF). To prevent these, developers have to actively take countermeasures such as implementing CSRF tokens.

  Are there any cases where SOP prevents the request from being sent and
  catches it before?

Yes. For example, you cannot specify methods other than GET, POST and HEAD by default. Other methods need to be explicitly allowed using a technique called cross-origin resource sharing (CORS).  That's why custom methods are sometimes used as a (questionable) alternative to CSRF tokens.

To allow a custom method FOO from any origin, the server could reply with these headers:

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: FOO

Here is how Google Chrome rejects a request with the method FOO to https://www.google.com:

You can see that the browser first sends a preflight OPTIONS request to check which methods are permitted via CORS. The server then replies with a 405 status indicating that FOO is not allowed - and the entire request fails.


OpenSSL_encrypt returning an incorrect cyphertext? I am trying to use the openssl_encrypt function in PHP, this is my code:

<?php

$message = hex2bin("00112233445566778899aabbccddeeff");
$key = hex2bin("000102030405060708090a0b0c0d0e0f");
$method = "AES-128-ECB";

$cyphertext = openssl_encrypt($message, $method, $key);
echo bin2hex(base64_decode($cyphertext)) . "\n";

?>

According to FIPS 197 (See page 35) and also this online AES Calculator, this should result in the following cyphertext:

69c4e0d86a7b0430d8cdb78070b4c55a

but instead my code returns this string:

69c4e0d86a7b0430d8cdb78070b4c55a954f64f2e4e86e9eee82d20216684899

What am I doing wrong? Does the openssl implementation use a different blocksize?

And yes, I do know that I'm not supposed to use ECB, but this is only for testing purposes, as soon as I have figured out why this doesn't work I'll switch to CBC.

Thank you very much for your help.

To quote from the php docs' comments, emphasis by me:

  In plain english, the buffer must be padded up to blockSize. If the
  buffer is already a multiple of blockSize, you add an entire new
  blockSize bytes as padding.

  The value of the padding bytes MUST be the number of padding bytes as
  a byte...

  So 5 bytes of padding will result in the following bytes added at the
  end of the ciphertext: [ 0x05 ][ 0x05 ][ 0x05 ][ 0x05 ][ 0x05 ]

  Hope this saves someone else a few hours of their life.

Your message is one full block. Thus, the implementation of openssl_encrypt adds a padding block. This is why the second half of your result (which you did not expect) neatly decrypts to

0x10101010101010101010101010101010

using plain aes with that key - it is a padding added by the implementation, because plain aes is not the same as aes-cbc.


How can I extract the certificate from this pcap file? I have a pcap file of 14 sniffed SSL packets. I uploaded it here:

ssl.pcap

I opened it with wireshark. I see the 14 packets. The largest of seems to contain a self signed certificate (as it is made in a populat internet tutorial). I see the packet contains test like "Some-state" and "Intenet Widgets Pty Ltd" ... How can I actually extract the real certificate (maybe in crt format?

With new versions of wireshark:

Make sure the traffic is decoded as SSL, i.e. setup the SSL analyzer for this TCP stream in Analyze >> Decode As. Now it will show the SSL details for the packets.
Pick the packet which contains the certificate, in this case packet 6.
In the packet details expand Secure Socket Layer etc until you get to the certificate itself:

Use the context menu (right click) and save the raw data of the certificate with Export Packet Bytes into a file, for example cert.der.
With openssl x509 -inform der -in cert.der -text you can have a look at the certificate, with openssl x509 -inform der -in cert.der -outform pem -out cert.crt you can convert it into a PEM format (i.e. what you mean with crt format).


How to check how I was hacked? Today I was notified by DigitalOcean that my droplet was hacked and a DDOS attack was generated from it. It was a droplet I used as a staging server for a webapp I will send to production later, and I just need to do vagrant destroy and vagrant up and I'll have my droplet again.

I don't need to recover my data, but I don't want this to happen when I'm in production, so I want to check how I was hacked, where can I start? Is there some standard steps to perform to do this?

If is relevant: It was a Ubuntu 14.04, with WP, Laravel and MariaDB in docker.

Without checking too deep, I would say WP is the top risk in that list. I assume its updated, so you should check its settings and the plugins you have installed.

Check this article: https://isc.sans.edu/forums/diary/Wordpress+Pingback+DDoS+Attacks/17801

  Sucuri detected an interesting "reflective" attack using the
  Wordpress Pingback feature to attack web sites [1]. Unlike other
  reflective attacks that use UDP services like NTP and DNS, this
  attacks uses the Wordpress Pingback feature.

  The intend of Pingback is to notify a site that you link to about the
  link hoping that the site you are linking to will return the favor.
  Some systems automate this and maintain automated lists linking back
  to sites that covered their article. In order to implement pingback,
  Wordpress implements an XML-RPC API function. This function will then
  send a request to the site to which you would like to send a
  "pingback"...


Does connecting from a compromised client affect a VNC server security? Let's say I connect to a Linux VNC server from a compromised Windows client.

Would this affect by any mean the server security?

Note:

The server run on a limited user privileges.
The programs that is used is TigerVNC or TightVNC.

If an attacker has taken control of your client host, and from this client host you connect to the VNC server, expect the attacker to have at the very least the same privileges as you on the VNC server's host and a complete view of your activity during the VNC session (screen content, keystrokes, etc.).

That's typically how an attacker progressively contaminate a full network: he starts by getting his hand on a few unprivileged client machines (through phishing emails or any other mean), then through this machines and using the user's legitimate accesses he can escalate to internal servers not directly accessible from the outside.


I just send username and password over https. Is this ok? When a user's logging in to my site, they send their username and password to me over https.  Besides the ssl, there's no special obfuscation of the password - it lives in memory in the browser in the clear.

Is there anything else I should do? Should I keep it hashed somehow, even in RAM?

This is fine.  You don't need to do anything else.  There is no need to hash it or obfuscate it in RAM.

You should be careful to hash the password appropriately on the server side before storing it in persistent memory (e.g., in a database), and you should take care to use proper methods for password hashing.  See, e.g., How to securely hash passwords?, Which password hashing method should I use?, Most secure password hash algorithm(s)?, Do any security experts recommend bcrypt for password storage?.

If you want to provide additional security for your users, here are some steps you could take:

Use site-wide SSL/TLS.  Any attempt to visit your site through HTTP should immediately redirect to HTTPS.
Enable HSTS on your site.  This tells browsers to only connect to you via HTTPS. Paypal uses it.  It is supported in recent versions of Firefox and Chrome.

I'm not saying you need to do these things (though site-wide SSL/TLS makes a big difference).  But these are some options that can help strengthen security against some common attack vectors.


Can my internet provider/government/anyone track or see what I follow on Tumblr? Can my internet provider, the government, or anyone know what I watch and follow on Tumblr/Tumblr app (with and without VPN)?

Without a VPN

Assuming that you are only using HTTPS, there will likely be a difference between your ISP and a government. This also depends on where in the world you are.

In many countries your ISP couldn't care less about what you do. In some countries though, governments make the ISP care - sadly, the UK is now one of those places.

An ISP will only have access to a log of the URL's you access so whether an ISP could track what you are following will depend on how you interact with Tumblr to follow someone.

A government, on the other hand, will probably find a way to do whatever they want if they consider it important enough.

So given that Tumblr is a public service and so subject to public scrutiny for its content and unless you live in a country with highly restrictive laws or you might be subject to professional blackmail (e.g. you are a teacher but show a liking for unpleasant subjects) and have a history of being in vocal opposition to your government, the risks would seem to be very low that anyone would really care.

With a VPN

Your ISP can no longer track you at all.

Once again though, a determined government attacker is likely to be able to eventually track you. The easiest way to do that would probably be to bug your house.

Again, the risk is generally so small as to be insignificant unless you fall into the categories outlined above.


SQL Injection update query I have a sqli and i can dump data from the DB with the query below  func=REC&lastid=7491&start=3&uid=56+union+all+select+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,concat(uid,':',email,':',password) FROM user WHERE uid=56; --&token=6eadee0862e6fe05d588cb29c416d9
How can i add an update query to change the password? I've tried the query below but it did't work
func=REC&lastid=7491&start=3&uid=56+union+all+select+1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,UPDATE
users SET password='xxxxxxx'; --&token=6eadee0862e6fe05d588cb29c416d9

The language/database framework on the server side is the best indicator on whether or you will be able to use stacked queries. If you can use stacked queries (executing multiple statements in one query: select * from users;drop table users;) it may be wiser to insert a user of your own, rather than altering an existing user.
If stacked queries are not possible you can often perform a password reset operation and then dump the password reset token from the database and use it to reset any users password.
As mentioned in other answers, you might be able to craft a webshell using union select into outfile for example. However that is often not feasible as it is a privileged database operation and requires the database server and web server to share the same file system and have weak permissions inside the web root.


Why should browser security be prioritized? From this answer about browser security:

  time to update if you really care about security

So if every other software and functions I need can work on a 32-bit OS, I guess the only reason for upgrade is the browser's security? Can you explain why browser security should be placed on the top priority, when:

Most of the websites I visit have SSL certificate,
Most of them are either big enough that I can trust that they can't be hacked, or small enough that I don't think it's profitable for the hackers,
Windows and Windows Defender are up-to-dated,
I can smell fishy websites?

I hope that this is not the overconfidence effect. And I hope that I'm not overconfident that I don't have overconfidence effect.

As always, a statistics or a case study may increase the convincing of the answer.

Can you explain why browser security should be placed on the top priority ...

Because the browser is processing lots of untrusted  content from the internet.

Of course, if you use any other programs which does this (like Mail client, maybe Office program, PDF reader) you should keep these updated too since vulnerabilities in these programs are a regular attack vector too.

  .. Most of the websites I visit have SSL certificate,

A SSL certificate says nothing about the trust you can have in a site. HTTPS only protects against sniffing modification of the traffic during transport. A HTTPS site can serve malware as much as a plain HTTP site can do.

Apart from that "Most of the websites" is not the same as "All of the websites".

  I can smell fishy websites?

Even if you might be confident in your ability to sniff websites where the URL looks fishy (which might actually be overconfidence) I'm pretty sure that you will not know up-front if the site you visit regularly got hacked and is serving malware (i.e. Watering hole attack or other kinds of hacking high-reputation sites to increase number of victims) or if it is serving malicious ads which are outside the control of the website itself (i.e. Malvertising).

EDIT:
After I've wrote my answer the OP added the following to the question:

  Most of them are either big enough that I can trust that they can't be hacked, ...

Too big to be hacked? While large web sites usually employ better security than smaller ones it does not mean they are unhackable. And sites with lots of customers are especially a lucrative target for the attackers since this also means lots of potential victims. Some examples:
 ... malicious ads on Forbes ... or ... New York Times and BBC hit by 'ransomware' malvertising or Study: One-third of top websites vulnerable or hacked.

  ... or small enough that I don't think it's profitable for the hackers, ...

Too small to be hacked? That's not true either: attackers use automated tools to hack insecure CMS installations like WordPress or Django en mass, i.e. it is very cheap to take over a vulnerable site this way.


Why would a U2F key be more secured than an OTP device? I have a Yubikey 5, I can store a PGP key inside, it has OTP abilities, FIDO, NFC, etc... Which is great for a device like this.
First of all, I understand how a smart card is more secured than an app/sms based OTP for instance, but seeing how the market is doing, I don’t get why it’s still considered more secured.
2FA means adding a second factor, which can be your mobile for SMS OTP, an OTP device (like RSA tokens), a USB key, and so on. Currently, almost all these solutions relies only on the fact that you own this object and nothing else (this is the case for Yubikeys and SMS OTPs), and app based OTPs now include an authentication to be launched, which makes it more secured. But without this authentication layer, a mobile is still less easy to lose than a tiny USB key. And why would a tiny USB key, advertised as being made to stay plugged in your computer forever makes it more secured at all?
I mean, if your laptop is stolen, and your thief happens to have your credentials, well, your smart card doesn’t authenticate you so it adds no security at all then, but so will be the app OTP as a thief could also have your pin code.
Anyway, seeing I find app based OTP more secured than key based today, which are more secured than portable always on tokens like RSA’s, not because of their design but because of how they’re used today. Am I right?

One of your main points is valid: if the USB key is stolen with your device, it may still be game over if other credentials are known. Personally, I am not concerned about loss or theft of the USB token, since it doesn't really weaken security if used as a second factor, plus access can be revoked and some features may require a PIN.
However, the USB token is superior to a phone in that it cannot be compromised remotely and have its secrets dumped. Also, FIDO2 provides a layer of protection against phishing attacks that OTP simply cannot provide.


GPG server hides search results? I'm new with gpg, I've tried --search-keys: "Bitcoin" - nothing found,

C:\Users\bdimych>gpg2 --keyserver pool.sks-keyservers.net --batch --search-keys "Bitcoin"
gpg: searching for "Bitcoin" from hkp server pool.sks-keyservers.net
gpg: key "Bitcoin" not found on keyserver

then --search-keys "Bitcoin Core" - found several entries.

C:\Users\bdimych>gpg2 --keyserver pool.sks-keyservers.net --batch --search-keys "Bitcoin Core"
gpg: searching for "Bitcoin Core" from hkp server pool.sks-keyservers.net
(1)     Wladimir J. van der Laan (Bitcoin Core binary release signing key) <la
          4096 bit RSA key 36C2E964, created: 2015-06-24, expires: 2017-02-13
(2)     A Core Dev <acoredev@bitcoin.org>
          4096 bit RSA key 7855F004, created: 2014-09-13, expires: 2024-09-10
Keys 1-2 of 2 for "Bitcoin Core".  gpg: Sorry, we are in batchmode - can't get input

It looks like the server has some filter?

You're simply hitting the maximum number of allowed keys in an answer.  For example searching my username:

$ gpg --keyserver pool.sks-keyservers.net --batch --search-keys "grochmal"
gpg: data source: http://mira.cbaines.net:11371
(1) Michal Grochmal <REDACTED>
    Michal Grochmal <REDACTED>
    Michal Grochmal <REDACTED>
      2048 bit RSA key 040E2771C840C4F6, created: 2014-08-21
Keys 1-1 of 1 for "grochmal".  gpg: Sorry, we are in batchmode - can't get input

But searching a common name would give a huge amount of keys, and the server will refuse to answer:

$ gpg --keyserver pool.sks-keyservers.net --batch --search-keys "mike"
gpg: error searching keyserver: No data
gpg: keyserver search failed: No data

In the Bitcoin case all that the server is telling you is that you exceeded the maximum number of allowed keys with your search for "Bitcoin", and you should try a more specific term (which "Bitcoin Core", or even simply "Bitcoin Co" turns to be).

The maximum number of returned keys that can be returned has been 1000 in the past (on pgp.subkeys.net).  But that is information from 10 years ago, I may be wrong, and the number is probably different now.


XSS attack on to get root priveleges Is there any way of execute an xss attack inside a Linux machine to get to sudo mode? I know Linux is designed to separate the two types of user.
I guess, i don't really know but I guess diferent distros use diferent ddl language.

Also: May I use C language to do a similar (I know that admin processes work on normal users on windows) script but for windows?

The short answer is no.  XSS is client-side injection used to attack browsers, meaning the attack manipulates the webpage which shows up in the user's browser.   In order to perform XSS attacks, you need to use HTML/JavaScript (C will not work).   As XSS is an attack against the browser, the only way to attack a linux system is if the browser is running on a linux system.

Theoretically, if you could leverage the XSS attack to get the browser to load a malicious Flash object which exploits a buffer overflow/other bug, you could get arbitrary code execution on the system, and then exploit a privilege escalation bug to get root access.  Theoretically do-able, but it relies on many other bugs to do the actually privilege escalation, and there are probably much easier ways to accomplish your goal.


Why does paxtest show OpenBSD as vulnerable? install60.iso
Executable anonymous mapping (mprotect) : Vulnerable
Executable bss (mprotect) : Vulnerable
Executable data (mprotect) : Vulnerable
Executable heap (mprotect) : Vulnerable
Executable shared library bss (mprotect) : Vulnerable
Executable shared library data (mprotect) : Vulnerable
Return to function (strcpy) : paxtest : return address contains a NULL byte.
Return to function (strcpy, PIE) : paxtest : return address contains a NULL byte.
Return to function (memcpy) : Vulnerable
Return to function (memcpy, PIE) : Vulnerable

Paxtest outputs on a few OS:

https://s22.postimg.org/f169vbabl/paxtest_openbsd.png

https://lut.im/C3F0KIhF6O/GPjZ5bRQrTK8fLpg.png

Question: Why is OpenBSD vulnerable? How can we harden it?

Increasing kern.stackgap_random=262144 to kern.stackgap_random=16777216 increases the "14 quality bits" to "20 quality bits".

But couldn't figure out how to fix the other Vulnerable parts.

Or the question should go to the security.stackexchange?

UPDATE: after: @Rufo El Magufo

wxallowed was in only at /usr/local, removed it:

# grep wxallowed /etc/fstab
# grep wxallowed /etc/fstab-BACKUP
2acbf0d2ff8159d4.h /usr/local ffs rw,wxallowed,nodev 1 2
#

and set the sysctl (but imho isn't this just for debugging purposes?)

# sysctl kern.wxabort
kern.wxabort=1
# grep kern.wxabort /etc/sysctl.conf
kern.wxabort=1
#

and rebooted, then ran the paxtest:

# ./paxtest blackhat
PaXtest - Copyright(c) 2003-2016 by Peter Busser <peter@adamantix.org> and Brad Spengler <spender@grsecurity.net>
Released under the GNU Public Licence version 2 or later

Writing output to /root/paxtest.log
It may take a while for the tests to complete
Test results:
gcc: no input files

Executable anonymous mapping             : Killed
Executable bss                           : Killed
Executable data                          : Killed
Executable heap                          : Killed
Executable stack                         : Killed
Executable anonymous mapping (mprotect)  : Vulnerable
Executable bss (mprotect)                : Vulnerable
Executable data (mprotect)               : Vulnerable
Executable heap (mprotect)               : Vulnerable
Executable shared library bss (mprotect) : Vulnerable
Executable shared library data (mprotect): Vulnerable
Executable stack (mprotect)              : Killed
Anonymous mapping randomization test     : 33 quality bits (guessed)
Heap randomization test (ET_EXEC)        : 38 quality bits (guessed)
Main executable randomization (ET_EXEC)  : 25 quality bits (guessed)
Shared library randomization test        : 33 quality bits (guessed)
Stack randomization test (SEGMEXEC)      : 20 quality bits (guessed)
Stack randomization test (PAGEEXEC)      : 20 quality bits (guessed)
Arg/env randomization test (SEGMEXEC)    : 20 quality bits (guessed)
Arg/env randomization test (PAGEEXEC)    : 20 quality bits (guessed)
Return to function (strcpy)              : paxtest: return address contains a NULL byte.
Return to function (strcpy, PIE)         : paxtest: return address contains a NULL byte.
Return to function (memcpy)              : Vulnerable
Return to function (memcpy, PIE)         : Vulnerable
Executable shared library bss            : Killed
Executable shared library data           : Killed
Writable text segments                   : Killed

# pwd
/root/paxtest-0.9.15-bsdfix
#
# uname -mrs
OpenBSD 6.0 amd64
#

still says "Vulnerable", strange.

if anyone interested, correction for the pax topic

  Sent: Tuesday, October 11, 2016 at 3:57 PM From: "W. Dean Freeman"
   To: "'Peter Janos'"
   Subject: RE: RE: OpenBSD PaX Test question
  Increasing the stack gap size isn't necessarily bad or good.
  Basically, you're adjusting the run-time value of a gap page that gets
  inserted at the top of a new stack frame, so that when an attacker is
  analyzing a binary and attempting to write an exploit, there is an
  unknown-at-compile-time number of bytes which have to be included when
  building the exploit and attempting to over-write the return address
  to the previous stack frame. It's just one of a series of mitigations
  against buffer overflows (like stack canaries, W^X, etc. You're also
  here adjusting the amount of room there is to play with when
  randomzing addresses for ASLR, at least as is my understanding.

  So, I doubt it hurts anything, but given the general strength of ASLR,
  stack gaps, stack cookies, the new W^X feature, etc. I'm not sure it's
  really necessary. If you really want to play with something fun that
  may ferret out bugs either in your code or in things you get from
  ports, turn on memory junking in the /etc/malloc.conf. For a
  discussion on some fun around that, see here:

  https://www.youtube.com/watch?v=YYf1U0xcHmk

  To the second question, there isn't any magic to what I'm doing in
  that program and between screenshots from GDB and a description of
  what's going on, you should be able to reconstruct it. There are three
  basic tests:
  1. Attempt to mmap(2) a page of memory with permissions PROT_WRITE|PROT_EXEC
  ** on OpenBSD, this will cause the program to abort. On HardenedBSD or NetBSD, you'll get a writable page of memory back
  ** If you get the page back, I put a bit of do-nothing shell code into the mapped buffer, then write a function pointer to it and attempt to
  execute in order to cause a page fault there and record the violation
  is caught properly, proving that I didn't get W|X memory
  2. attempt to map a page of memory as writable then mprotect() to W|X. With PaX, the page stays writable. OpenBSD will abort the processes
  here
  ** I did share a version with Red Hat through technical community channels, which included proof via live shell code that even if you
  turn off execmem allocation in SELinux, that you get no protection
  around mprotect and can still get a shell here.
  3. Attempt to map a page of memory as executable and then mprotect() to W|X. Again, OpenBSD will abort this but PaX just gives you back
  what you had originally

  I may be able to share the tool, but it basically just does a subset
  of what is in the paxtest, geared directly at three sub-cases for one
  security functional requirement which isn't even mandatory right now.
  However, RedHat didn't want to burn political capital with the Linux
  kernel devs pushing for it when OpenBSD didn't even turn it on. Now
  that they have, there may be a better case to be made in that regard.

  ----- W. Dean Freeman, CISSP, CSSLP, GCIH Lead Security Engineer Mobile: +1.8048158786 wdfreeman@acumensecurity.net
  http://www.acumensecurity.net

  -----Original Message----- From: Peter Janos [mailto:peterjanos2@mail.com] Sent: Tuesday, October 11, 2016 2:23 AM
  To: W. Dean Freeman  Subject: Re: RE:
  OpenBSD PaX Test question

  Only two question:

  ======================================

  1) Increasing kern.stackgap_random=262144 to
  kern.stackgap_random=16777216 increases the "14 quality bits" to "20
  quality bits".

  Stack randomization test (SEGMEXEC) : 20 quality bits (guessed) Stack
  randomization test (PAGEEXEC) : 20 quality bits (guessed) Arg/env
  randomization test (SEGMEXEC) : 20 quality bits (guessed) Arg/env
  randomization test (PAGEEXEC) : 20 quality bits (guessed

  is this a wise thing to do? Does setting the kern.stackgap_random to
  16777216 increases security?

  ======================================

  2) Can we have the cc-memtest binary or source? Or it is not public.
  http://blog.acumensecurity.net/revisiting-wx-with-openbsd-6-0/

  ======================================

  Many Thanks!

    Sent: Monday, October 10, 2016 at 5:46 PM
    From: "W. Dean Freeman"
    To: "'Peter Janos'"
    Subject: RE: OpenBSD PaX Test question

    Sure, go ahead.

    From: Peter Janos [mailto:peterjanos2@mail.com]
    Sent: Monday, October 10, 2016 11:46 AM
    To: W. Dean Freeman
    Subject: Re: OpenBSD PaX Test question

    can I post this as an anser on stackexchange?

    Thank you!

    Sent: Monday, October 10, 2016 at 4:36 PM
    From: "W. Dean Freeman"  >
    To: peterjanos2@mail.com
    Subject: OpenBSD PaX Test question

    -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hi Peter,

    I'm the author of the blog post that you referenced in your stack exch
    ange post.

    As you may note from the blog post, I make three points in particular:

    OpenBSD does not follow the PaX model (and therefor shouldn't be
    expected to do everything that paxtest checks for, necessarily, and
    certainly not in the same way) 2. In OpenBSD, you can still use
    mprotect() To switch between wri table and executable pages of memory,
    because what is enforced is stri ctly W^X, not W!->X.
    My claims about OpenBSD 6.0 were strictly in relation to the c
    onformance with FPT_W^X_EXT.1 in the latest revisions of the NIAP-appr
    oved Operating System Protection Profile for Common Criteria.

    So, an operating system like HardenedBSD or NetBSD, which follow the P
    aX model, will not allow you to successfully do something like this:
    * Map a page of memory as writable
    * Subsequently mprotect() that page to W|X
    * OR mprotect() that page to just X after it was W

    On OpenBSD, the behavior is:
    * You cannot map a page of memory W|X
    * You cannot mprotect(2) a page of memory that is W to W|X
    * You can map a page of memory as, say, R|W, then mprotect(2) t o R|X

    This allows you to, say, run new Firefox builds, which use this mprote
    ct(2) swapping method to keep pages allocated by the JIT from being W|
    X at the same time without having to push Firefox off onto a separate
    /opt filesystem or something where you have fs flags to remove the W^X
    protections. In HardenedBSD or NetBSD you would still have to use se
    cadm or paxctl to remove the mprotect hardening on a per-binary/per-pr
    ocess basis because the PaX model wouldn't let you swap the permission
    s.

    I demonstrated this in the blog post, towards the end, and then explai
    ned why this matters in the context of JITs.

    Please let me know if you have any other questions, but I hope this he
    lps clear it up. Essentially, your'e going to get those "vulnerable"
    messages from the pax test tool because OpenSBD doesn't do PaX.

    Thanks,
    Dean

    W. Dean Freeman, CISSP, CSSLP, GCIH
    Lead Security Engineer
    Mobile: +1.8048158786
    wdfreeman@acumensecurity.net

    http://www.acumensecurity.net http://www.acumensecurity.net/

    -----BEGIN PGP SIGNATURE-----

    iQFRBAEBAgA7BQJX+6daNBxXaWxsaWFtIERlYW4gRnJlZW1hbiA8d2RmcmVlbWFu
    QGFjdW1lbnNlY3VyaXR5Lm5ldD4ACgkQrnqwKenh3fRbrQgAjFsvyXA6bZIPYyjX
    0A3ldKlFTekRuyFnhmWuX3CsK5eV7azrADyamuPV5T2YMN7U0tmjcOC9hOX3OPsK
    0IC9YqTjGxpLuxt0Z7GeXeeRO58SvroKMbsKZz6pU8pvKAJn8Hl/0UcAJsmfcHUd
    6ErH7wuHgpCEzTHGkiEIz1W/kPZXUsRhT9XpURUCBwOp01vsl5Lm9GfYWb64zHCM
    f9fDwkasE/Dy8amn907bGLSP1M711HhVB5cP76xe0twYyxOKtNRlJno2Kc9cEr4D
    d2U/r/iCG8A9Qabp+QBuxVWTdP3kq2LwDqb6ySUSLLrSYLbRjUOi+7GhQer3yM+r
    6TEFcQ==
    =gBZh
    -----END PGP SIGNATURE-----


Demonstration of how security through obscurity fails to work I need to demonstrate that security through obscurity fails twice in the following scenario.

I've a secret KEY.

User A gets MessageX = SecretTransformation(KEY, SecretValue1);

User B gets MessageY = SecretTransformation(KEY, SecretValue2);

SecretTransformation() is not a standard cryptographic function.

Now, Security through obscurity is in contrast with principle of open design and shannon's maxim. We also know that this security will fail as soon as an attacker manages to retrieve one of the "secrets"

what in addition it think can be demonstrated, is that:

if an attacker manages to retrieve, MessageX and MessageY without knowing any secret he can perform some cryptanalysis attack and retrieve the KEY or understand the SecretTransformation functioning.

This is supposed to be true and get stronger with the number of messages the attacker is able to collect.
messageX
messageY
...
messageN
I hope I've explained myself i need to be pointed out to some example like the one time pad, where if you XOR with the key more then one message you can XOR back and retrieve the secret.

here there is an image for the schema suggested
http://s17.postimage.org/mdgij13un/bad_Transformation.png

Thank you!

There is no such law.  You mention that you think a bunch of things are true, but I do not think those things are in fact true, so I think you need to re-examine your premises.

"Security through obscurity" does not mean that a system is necessarily insecure.  It is a bad strategy and a bad idea for the security of your system to rely upon the secrecy of your system.  Historically, most systems that have relied upon security through obscurity have proven to provide poor security.

But hiding the details of the system doesn't magically somehow transform a secure system into an insecure system.  If you encrypt with PGP, but just don't tell anyone you're doing so, this doesn't somehow make PGP insecure.  There is no law that says all systems that fail to disclose their details are necessarily insecure.


Strange Apache access logs A site of ours has been targeted by some kind of strange attack and I am trying to work out exactly how it has happening. Basically, the strangest thing is that the logs seem to correspond to entirely different websites and thus is producing 404 errors all the time. Any ideas what kind of attack this is, how it is happening and why it is not showing the true site URL?

216.244.83.56 - - [05/Apr/2014:22:43:44 +0100] "GET http://anx.batanga.net/ttj?id=2385001&size=728x90 HTTP/1.0" 404 9 "http://www.daysalary.com/?p=1622" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/4.0.206.1 Safari/532.0"
172.246.42.217 - - [05/Apr/2014:22:43:44 +0100] "GET http://ads.yahoo.com/st?ad_type=ad&ad_size=728x90&section=5200303&pub_url=${PUB_URL} HTTP/1.0" 404 9 "http://www.healthbecare.com/?p=408" "Mozilla/4.0 (MSIE 6.0; Windows NT 5.0)"
216.176.190.44 - - [05/Apr/2014:22:43:44 +0100] "GET http://anx.batanga.net/ttj?id=2483524&size=728x90 HTTP/1.0" 404 9 "http://www.especialfinance.com/?p=1383" "Mozilla/4.0 (compatible; MSIE 6.0; America Online Browser 1.1; rev1.5; Windows NT 5.1; SV1; FunWebProducts; .NET CLR 1.1.4322)"
67.198.154.66 - - [05/Apr/2014:22:43:44 +0100] "GET http://ad.afy11.net/srad.js?azId=1000011319807 HTTP/1.1" 404 9 "http://rumorfix.com/" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.2) Gecko/20121231 Firefox/3.5.2 WinNT-PAI 21.07.2009"
216.244.76.188 - - [05/Apr/2014:22:43:44 +0100] "GET http://ads.yahoo.com/st?ad_type=pop&ad_size=0x0&section=5376206&banned_pop_types=29&pop_times=1&pop_frequency=0&pub_url=${PUB_URL} HTTP/1.0" 404 9 "http://www.supermoviepass.com/index.php?option=com_content&view=article&id=1106:2013-12-18-20-38-05&catid=46:kids-movies&Itemid=160" "Opera/9.80 (Windows NT 6.0; U; en) Presto/2.7.39 Version/11.00"
208.115.109.39 - - [05/Apr/2014:22:43:45 +0100] "GET http://anx.batanga.net/ttj?id=2481220&size=300x250 HTTP/1.0" 404 9 "http://www.pusheducation.com/tag/california-community-college-listing/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/532.9 (KHTML, like Gecko) Chrome/5.0.307.1 Safari/532.9"

As you can see in the logs this appears to be some kind of distributed denial of service. The attack is fast but not so fast that it will bring down Apache on it's own but the constant processing of application logic did put our server under a lot of strain.

It seems "they" are trying to get different ads through your server - expecting it to behave as an HTTP proxy server.  (Maybe your was misconfigured before to be an open proxy.)

Instead of sending a:

GET /filename.php HTTP/1.1

They're sending a

GET http://adhost.com/dir/file HTTP/1.1

This way, "they" will be able to render many ads for their websites, coming from different IP addresses, essentially driving up their impressions, and potentially getting more money.

Ensure your server is not an open proxy, and else - don't worry, bots send all kind of requests to any public webserver.