The most notorious programming language for remote file inclusion is PHP. The following is the php example code for PHP remote file inclusion vulnerability from wikipedia article "File Inlucsion Vulnerability". In this example, code from an external server is included, thus it is run by the vulnerable application. Remote file inclusion is a remote code execution class vulnerability.
<?php if ( isset( $_GET['language'] ) ) { include( $_GET['language'] . '.php' ); } ?>
An XXE (XML External Entity) vulnerability can also be similar to the example above. The following is an example from OWASP abuses the expect scheme to execute code. This is only for PHP.
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE foo [ <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM "expect://id" >]> <creds> <user>&xxe;</user> <pass>mypass</pass> </creds>
The expect scheme execute the command (on OS level, rather than as PHP code). PHP has a document that explain how the expect scheme is meant to be used.
But if we remove focus from PHP, and look at web application in general, XXE can often only be abused to look at local files (or remote files the vulnerable web application have network access to). Commonly done with the following payload:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE foo [ <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM "file:///etc/passwd" >]><foo>&xxe;</foo>
Another misuse case for XXE, is that it can be used to trigger sensitive calls to internal web applications using the GET method. For instance:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE foo [ <!ELEMENT foo ANY > <!ENTITY xxe SYSTEM "https://internal.hawaii.gov/api/pacom/alert" >]><foo>&xxe;</foo>
But the bottom line is that remote file inclusion and XXE is unrelated. Both might lead to remote code execution. But generally, remote file inclusion is remote code execution and XXE is abused to steal data from local files (on the server)